Skip to content

Instantly share code, notes, and snippets.

View yjbanov's full-sized avatar
💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web

Yegor yjbanov

💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web
View GitHub Profile
main() async {
final FlutterDriver driver = await FlutterDriver.connect();
integrationDriver(
driver,
onScreenshot: (String screenshotName, List<int> screenshotBytes) {
// flutter/goldens
// Skia Gold
},
);
}
// use-case
var colorFilter = CkColorFilter();
var imageFilter = colorFilter.toImageFilter();
var backdropFilter = CkBackdropFilter(imageFilter);
paint.colorFilter = colorFilter;
paint.imageFilter = imageFilter;
paint.imageFilter = colorFilter;
// ui
@yjbanov
yjbanov / poolexample.dart
Created August 10, 2020 23:33
Using package:pool to parallelize work across multiple processes
import 'dart:async';
import 'dart:io';
import 'package:pool/pool.dart';
Pool pool = Pool(8);
main() async {
final input = List<int>.generate(80, (i) => i);
final results = pool.forEach(
input,
$ felt build
Running gn...
Generating GN files in: out/host_debug_unopt
Done. Made 672 targets from 223 files in 253ms
Running ninja (with default ninja parallelization)...
ninja: Entering directory `/home/yjbanov/code/flutter/engine/src/out/host_debug_unopt'
[7/17] ACTION //flutter/web_sdk:flutter_dartdevc_kernel_sdk_sound(//build/toolchain/linux:clang_x64)
FAILED: flutter_web_sdk/kernel/amd-sound/dart_sdk.js flutter_web_sdk/kernel/amd-sound/dart_sdk.js.map
python ../../third_party/dart/build/gn_run_binary.py compiled_action /home/yjbanov/code/flutter/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/dart --packages=/home/yjbanov/code/flutter/engine/src/third_party/dart/.packages --dfe=/home/yjbanov/code/flutter/engine/src/third_party/dart/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot /home/yjbanov/code/flutter/engine/src/third_party/dart/pkg/dev_compiler/bin/dartdevc.dart --enable-experiment=non-nullable --sound-null-safety --compile-sdk dart:core dart:ui dart:_engine --no-summarize --pa
@JS('window.flutter_canvas_kit.BlendMode.Clear.value')
external int get canvasKitBlendModeClear;
@JS('window.flutter_canvas_kit.BlendMode.Src.value')
external int get canvasKitBlendModeSrc;
@JS('window.flutter_canvas_kit.BlendMode.Dst.value')
external int get canvasKitBlendModeDst;
@JS('window.flutter_canvas_kit.BlendMode.SrcOver.value')
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'test_async_utils.dart';
at Object.wrapException (http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:1120:17)
at http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:11775:25
at _wrapJsFunctionForAsync_closure.$protected (http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:4434:15)
at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:15290:12)
at StackZoneSpecification__registerBinaryCallback__closure.call$0 (http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:28204:48)
at StackZoneSpecification._stack_zone_specification$_run$1$2 (http://localhost:34061/oxa3Xvg%2FKNGhAsT2ZmdLTap58t5W329Q/test/canvaskit/path_metrics_test.dart.browser_test.dart.js:2812
void _buildSegments() {
assert(_segments.isEmpty, '_buildSegments should be called once');
_isClosed = false;
double distance = 0.0;
bool haveSeenMoveTo = false;
final List<PathCommand> commands = subPath.commands;
double currentX = 0.0, currentY = 0.0;
final Function lineToHandler = (double x, double y) {
final double dx = currentX - x;
updateNode$11$actions$childrenInHitTestOrder$childrenInTraversalOrder$decreasedValue$flags$id$increasedValue$label$rect$transform$value: function(actions, childrenInHitTestOrder, childrenInTraversalOrder, decreasedValue, flags, id, increasedValue, label, rect, transform, value) {
var t1, matrix32, _null = null;
if (C.JSString_methods.contains$1(H.S(label), "_Required"))
throw H.wrapException(P.Exception_Exception('Value of label is "' + H.S(label) + '" of type ' + J.get$runtimeType$(label).toString$0(0)));
t1 = transform.length;
if (t1 !== 16)
throw H.wrapException(P.ArgumentError$("transform argument must have 16 entries."));
matrix32 = new Float32Array(16);
if (15 >= t1)
return H.ioore(transform, 15);
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
class Foo {
Foo({this.x, this.y});
final int x;
final int y;
toString() => '($x, $y)';