|
|
|
|
@@ -3,6 +3,13 @@
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
part of dart.ui;
|
|
|
|
|
|
|
|
|
|
// Examples can assume:
|
|
|
|
|
// // (for the example in Color)
|
|
|
|
|
// // ignore_for_file: use_full_hex_values_for_flutter_colors
|
|
|
|
|
// late ui.Image _image;
|
|
|
|
|
// dynamic _cacheImage(dynamic _, [dynamic __]) { }
|
|
|
|
|
// dynamic _drawImage(dynamic _, [dynamic __]) { }
|
|
|
|
|
|
|
|
|
|
// Some methods in this file assert that their arguments are not null. These
|
|
|
|
|
// asserts are just to improve the error messages; they should only cover
|
|
|
|
|
// arguments that are either dereferenced _in Dart_, before being passed to the
|
|
|
|
|
@@ -60,10 +67,10 @@ Color _scaleAlpha(Color a, double factor) {
|
|
|
|
|
/// Here are some ways it could be constructed:
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// Color c = const Color(0xFF42A5F5);
|
|
|
|
|
/// Color c = const Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5);
|
|
|
|
|
/// Color c = const Color.fromARGB(255, 66, 165, 245);
|
|
|
|
|
/// Color c = const Color.fromRGBO(66, 165, 245, 1.0);
|
|
|
|
|
/// Color c1 = const Color(0xFF42A5F5);
|
|
|
|
|
/// Color c2 = const Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5);
|
|
|
|
|
/// Color c3 = const Color.fromARGB(255, 66, 165, 245);
|
|
|
|
|
/// Color c4 = const Color.fromRGBO(66, 165, 245, 1.0);
|
|
|
|
|
/// ```
|
|
|
|
|
///
|
|
|
|
|
/// If you are having a problem with `Color` wherein it seems your color is just
|
|
|
|
|
@@ -1418,15 +1425,11 @@ class Paint {
|
|
|
|
|
/// [ImageFilter.blur]:
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// import 'dart:ui' as ui;
|
|
|
|
|
///
|
|
|
|
|
/// ui.Image image;
|
|
|
|
|
///
|
|
|
|
|
/// void paint(Canvas canvas, Size size) {
|
|
|
|
|
/// canvas.drawImage(
|
|
|
|
|
/// image,
|
|
|
|
|
/// Offset.zero,
|
|
|
|
|
/// Paint()..imageFilter = ui.ImageFilter.blur(sigmaX: .5, sigmaY: .5),
|
|
|
|
|
/// _image,
|
|
|
|
|
/// ui.Offset.zero,
|
|
|
|
|
/// Paint()..imageFilter = ui.ImageFilter.blur(sigmaX: 0.5, sigmaY: 0.5),
|
|
|
|
|
/// );
|
|
|
|
|
/// }
|
|
|
|
|
/// ```
|
|
|
|
|
@@ -1738,6 +1741,8 @@ class Image {
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// import 'dart:async';
|
|
|
|
|
/// import 'dart:typed_data';
|
|
|
|
|
/// import 'dart:ui';
|
|
|
|
|
///
|
|
|
|
|
/// Future<Image> _loadImage(int width, int height) {
|
|
|
|
|
/// final Completer<Image> completer = Completer<Image>();
|
|
|
|
|
@@ -1775,7 +1780,7 @@ class Image {
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// class MyImageHolder {
|
|
|
|
|
/// MyImageLoader(this.image);
|
|
|
|
|
/// MyImageHolder(this.image);
|
|
|
|
|
///
|
|
|
|
|
/// final Image image;
|
|
|
|
|
///
|
|
|
|
|
@@ -1890,8 +1895,8 @@ typedef ImageDecoderCallback = void Function(Image result);
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// /// BAD
|
|
|
|
|
/// Future<void> nextFrameRoutine(Codec codec) async {
|
|
|
|
|
/// final FrameInfo frameInfo = await codec.getNextFrame();
|
|
|
|
|
/// Future<void> nextFrameRoutine(ui.Codec codec) async {
|
|
|
|
|
/// final ui.FrameInfo frameInfo = await codec.getNextFrame();
|
|
|
|
|
/// _cacheImage(frameInfo);
|
|
|
|
|
/// // ERROR - _cacheImage is now responsible for disposing the image, and
|
|
|
|
|
/// // the image may not be available any more for this drawing routine.
|
|
|
|
|
@@ -1906,8 +1911,8 @@ typedef ImageDecoderCallback = void Function(Image result);
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// /// GOOD
|
|
|
|
|
/// Future<void> nextFrameRoutine(Codec codec) async {
|
|
|
|
|
/// final FrameInfo frameInfo = await codec.getNextFrame();
|
|
|
|
|
/// Future<void> nextFrameRoutine(ui.Codec codec) async {
|
|
|
|
|
/// final ui.FrameInfo frameInfo = await codec.getNextFrame();
|
|
|
|
|
/// _cacheImage(frameInfo.image.clone(), frameInfo.duration);
|
|
|
|
|
/// _drawImage(frameInfo.image.clone(), frameInfo.duration);
|
|
|
|
|
/// // This method is done with its handle, and has passed handles to its
|
|
|
|
|
@@ -3112,18 +3117,16 @@ class ColorFilter implements ImageFilter {
|
|
|
|
|
/// Every pixel's color value, repsented as an `[R, G, B, A]`, is matrix
|
|
|
|
|
/// multiplied to create a new color:
|
|
|
|
|
///
|
|
|
|
|
/// ```text
|
|
|
|
|
/// | R' | | a00 a01 a02 a03 a04 | | R |
|
|
|
|
|
/// | G' | | a10 a11 a22 a33 a44 | | G |
|
|
|
|
|
/// | B' | = | a20 a21 a22 a33 a44 | * | B |
|
|
|
|
|
/// | A' | | a30 a31 a22 a33 a44 | | A |
|
|
|
|
|
/// | 1 | | 0 0 0 0 1 | | 1 |
|
|
|
|
|
/// ```
|
|
|
|
|
/// | R' | | a00 a01 a02 a03 a04 | | R |
|
|
|
|
|
/// | G' | | a10 a11 a22 a33 a44 | | G |
|
|
|
|
|
/// | B' | = | a20 a21 a22 a33 a44 | * | B |
|
|
|
|
|
/// | A' | | a30 a31 a22 a33 a44 | | A |
|
|
|
|
|
/// | 1 | | 0 0 0 0 1 | | 1 |
|
|
|
|
|
///
|
|
|
|
|
/// The matrix is in row-major order and the translation column is specified
|
|
|
|
|
/// in unnormalized, 0...255, space. For example, the identity matrix is:
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// const ColorFilter identity = ColorFilter.matrix(<double>[
|
|
|
|
|
/// 1, 0, 0, 0, 0,
|
|
|
|
|
/// 0, 1, 0, 0, 0,
|
|
|
|
|
@@ -3136,7 +3139,7 @@ class ColorFilter implements ImageFilter {
|
|
|
|
|
///
|
|
|
|
|
/// An inversion color matrix:
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// const ColorFilter invert = ColorFilter.matrix(<double>[
|
|
|
|
|
/// -1, 0, 0, 0, 255,
|
|
|
|
|
/// 0, -1, 0, 0, 255,
|
|
|
|
|
@@ -3147,7 +3150,7 @@ class ColorFilter implements ImageFilter {
|
|
|
|
|
///
|
|
|
|
|
/// A sepia-toned color matrix (values based on the [Filter Effects Spec](https://www.w3.org/TR/filter-effects-1/#sepiaEquivalent)):
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// const ColorFilter sepia = ColorFilter.matrix(<double>[
|
|
|
|
|
/// 0.393, 0.769, 0.189, 0, 0,
|
|
|
|
|
/// 0.349, 0.686, 0.168, 0, 0,
|
|
|
|
|
@@ -3158,7 +3161,7 @@ class ColorFilter implements ImageFilter {
|
|
|
|
|
///
|
|
|
|
|
/// A greyscale color filter (values based on the [Filter Effects Spec](https://www.w3.org/TR/filter-effects-1/#grayscaleEquivalent)):
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// const ColorFilter greyscale = ColorFilter.matrix(<double>[
|
|
|
|
|
/// 0.2126, 0.7152, 0.0722, 0, 0,
|
|
|
|
|
/// 0.2126, 0.7152, 0.0722, 0, 0,
|
|
|
|
|
@@ -4123,7 +4126,7 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// Consider the following snippit of GLSL code.
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```glsl
|
|
|
|
|
/// layout (location = 0) uniform float a;
|
|
|
|
|
/// layout (location = 1) uniform vec2 b;
|
|
|
|
|
/// layout (location = 2) uniform vec3 c;
|
|
|
|
|
@@ -4147,7 +4150,7 @@ class FragmentProgram extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// Consider the following snippit of GLSL code.
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// ```glsl
|
|
|
|
|
/// layout (location = 0) uniform sampler2D a;
|
|
|
|
|
/// layout (location = 1) uniform sampler2D b;
|
|
|
|
|
/// ```
|
|
|
|
|
@@ -4725,12 +4728,15 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// following two clip method calls:
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// clipPath(Path()
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(10, 10, 20, 20))
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(80, 80, 100, 100)));
|
|
|
|
|
/// clipPath(Path()
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(80, 10, 100, 20))
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(10, 80, 20, 100)));
|
|
|
|
|
/// void draw(Canvas canvas) {
|
|
|
|
|
/// canvas.clipPath(Path()
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(10, 10, 20, 20))
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(80, 80, 100, 100)));
|
|
|
|
|
/// canvas.clipPath(Path()
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(80, 10, 100, 20))
|
|
|
|
|
/// ..addRect(const Rect.fromLTRB(10, 80, 20, 100)));
|
|
|
|
|
/// ...
|
|
|
|
|
/// }
|
|
|
|
|
/// ```
|
|
|
|
|
///
|
|
|
|
|
/// After executing both of those calls there is no area left in which to draw
|
|
|
|
|
@@ -5178,12 +5184,14 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// class Sprite {
|
|
|
|
|
/// Sprite(this.index, this.center);
|
|
|
|
|
/// int index;
|
|
|
|
|
/// double centerX;
|
|
|
|
|
/// double centerY;
|
|
|
|
|
/// Offset center;
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// class MyPainter extends CustomPainter {
|
|
|
|
|
/// MyPainter(this.spriteAtlas, this.allSprites);
|
|
|
|
|
///
|
|
|
|
|
/// // assume spriteAtlas contains N 10x10 sprites side by side in a (N*10)x10 image
|
|
|
|
|
/// ui.Image spriteAtlas;
|
|
|
|
|
/// List<Sprite> allSprites;
|
|
|
|
|
@@ -5200,8 +5208,8 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// anchorX: 5.0,
|
|
|
|
|
/// anchorY: 5.0,
|
|
|
|
|
/// // Location at which to draw the center of the sprite
|
|
|
|
|
/// translateX: sprite.centerX,
|
|
|
|
|
/// translateY: sprite.centerY,
|
|
|
|
|
/// translateX: sprite.center.dx,
|
|
|
|
|
/// translateY: sprite.center.dy,
|
|
|
|
|
/// ),
|
|
|
|
|
/// ], <Rect>[
|
|
|
|
|
/// for (Sprite sprite in allSprites)
|
|
|
|
|
@@ -5217,14 +5225,16 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// class Sprite {
|
|
|
|
|
/// Sprite(this.index, this.center, this.alpha, this.rotation);
|
|
|
|
|
/// int index;
|
|
|
|
|
/// double centerX;
|
|
|
|
|
/// double centerY;
|
|
|
|
|
/// Offset center;
|
|
|
|
|
/// int alpha;
|
|
|
|
|
/// double rotation;
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// class MyPainter extends CustomPainter {
|
|
|
|
|
/// MyPainter(this.spriteAtlas, this.allSprites);
|
|
|
|
|
///
|
|
|
|
|
/// // assume spriteAtlas contains N 10x10 sprites side by side in a (N*10)x10 image
|
|
|
|
|
/// ui.Image spriteAtlas;
|
|
|
|
|
/// List<Sprite> allSprites;
|
|
|
|
|
@@ -5241,8 +5251,8 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// anchorX: 5.0,
|
|
|
|
|
/// anchorY: 5.0,
|
|
|
|
|
/// // Location at which to draw the center of the sprite
|
|
|
|
|
/// translateX: sprite.centerX,
|
|
|
|
|
/// translateY: sprite.centerY,
|
|
|
|
|
/// translateX: sprite.center.dx,
|
|
|
|
|
/// translateY: sprite.center.dy,
|
|
|
|
|
/// ),
|
|
|
|
|
/// ], <Rect>[
|
|
|
|
|
/// for (Sprite sprite in allSprites)
|
|
|
|
|
@@ -5348,12 +5358,14 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// class Sprite {
|
|
|
|
|
/// Sprite(this.index, this.center);
|
|
|
|
|
/// int index;
|
|
|
|
|
/// double centerX;
|
|
|
|
|
/// double centerY;
|
|
|
|
|
/// Offset center;
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// class MyPainter extends CustomPainter {
|
|
|
|
|
/// MyPainter(this.spriteAtlas, this.allSprites);
|
|
|
|
|
///
|
|
|
|
|
/// // assume spriteAtlas contains N 10x10 sprites side by side in a (N*10)x10 image
|
|
|
|
|
/// ui.Image spriteAtlas;
|
|
|
|
|
/// List<Sprite> allSprites;
|
|
|
|
|
@@ -5367,7 +5379,8 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// Float32List rectList = Float32List(allSprites.length * 4);
|
|
|
|
|
/// Float32List transformList = Float32List(allSprites.length * 4);
|
|
|
|
|
/// for (int i = 0; i < allSprites.length; i++) {
|
|
|
|
|
/// final double rectX = sprite.spriteIndex * 10.0;
|
|
|
|
|
/// Sprite sprite = allSprites[i];
|
|
|
|
|
/// final double rectX = sprite.index * 10.0;
|
|
|
|
|
/// rectList[i * 4 + 0] = rectX;
|
|
|
|
|
/// rectList[i * 4 + 1] = 0.0;
|
|
|
|
|
/// rectList[i * 4 + 2] = rectX + 10.0;
|
|
|
|
|
@@ -5379,11 +5392,11 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// // the necessary values or do the same math directly.
|
|
|
|
|
/// transformList[i * 4 + 0] = 1.0;
|
|
|
|
|
/// transformList[i * 4 + 1] = 0.0;
|
|
|
|
|
/// transformList[i * 4 + 2] = sprite.centerX - 5.0;
|
|
|
|
|
/// transformList[i * 4 + 3] = sprite.centerY - 5.0;
|
|
|
|
|
/// transformList[i * 4 + 2] = sprite.center.dx - 5.0;
|
|
|
|
|
/// transformList[i * 4 + 3] = sprite.center.dy - 5.0;
|
|
|
|
|
/// }
|
|
|
|
|
/// Paint paint = Paint();
|
|
|
|
|
/// canvas.drawAtlas(spriteAtlas, transformList, rectList, null, null, null, paint);
|
|
|
|
|
/// canvas.drawRawAtlas(spriteAtlas, transformList, rectList, null, null, null, paint);
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// ...
|
|
|
|
|
@@ -5394,14 +5407,16 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// class Sprite {
|
|
|
|
|
/// Sprite(this.index, this.center, this.alpha, this.rotation);
|
|
|
|
|
/// int index;
|
|
|
|
|
/// double centerX;
|
|
|
|
|
/// double centerY;
|
|
|
|
|
/// Offset center;
|
|
|
|
|
/// int alpha;
|
|
|
|
|
/// double rotation;
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// class MyPainter extends CustomPainter {
|
|
|
|
|
/// MyPainter(this.spriteAtlas, this.allSprites);
|
|
|
|
|
///
|
|
|
|
|
/// // assume spriteAtlas contains N 10x10 sprites side by side in a (N*10)x10 image
|
|
|
|
|
/// ui.Image spriteAtlas;
|
|
|
|
|
/// List<Sprite> allSprites;
|
|
|
|
|
@@ -5416,7 +5431,8 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// Float32List transformList = Float32List(allSprites.length * 4);
|
|
|
|
|
/// Int32List colorList = Int32List(allSprites.length);
|
|
|
|
|
/// for (int i = 0; i < allSprites.length; i++) {
|
|
|
|
|
/// final double rectX = sprite.spriteIndex * 10.0;
|
|
|
|
|
/// Sprite sprite = allSprites[i];
|
|
|
|
|
/// final double rectX = sprite.index * 10.0;
|
|
|
|
|
/// rectList[i * 4 + 0] = rectX;
|
|
|
|
|
/// rectList[i * 4 + 1] = 0.0;
|
|
|
|
|
/// rectList[i * 4 + 2] = rectX + 10.0;
|
|
|
|
|
@@ -5434,8 +5450,8 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// anchorX: 5.0,
|
|
|
|
|
/// anchorY: 5.0,
|
|
|
|
|
/// // Location at which to draw the center of the sprite
|
|
|
|
|
/// translateX: sprite.centerX,
|
|
|
|
|
/// translateY: sprite.centerY,
|
|
|
|
|
/// translateX: sprite.center.dx,
|
|
|
|
|
/// translateY: sprite.center.dy,
|
|
|
|
|
/// );
|
|
|
|
|
/// transformList[i * 4 + 0] = transform.scos;
|
|
|
|
|
/// transformList[i * 4 + 1] = transform.ssin;
|
|
|
|
|
@@ -5449,7 +5465,7 @@ class Canvas extends NativeFieldWrapperClass1 {
|
|
|
|
|
/// colorList[i] = sprite.alpha << 24;
|
|
|
|
|
/// }
|
|
|
|
|
/// Paint paint = Paint();
|
|
|
|
|
/// canvas.drawAtlas(spriteAtlas, transformList, rectList, colorList, BlendMode.srcIn, null, paint);
|
|
|
|
|
/// canvas.drawRawAtlas(spriteAtlas, transformList, rectList, colorList, BlendMode.srcIn, null, paint);
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// ...
|
|
|
|
|
@@ -6081,30 +6097,33 @@ typedef _Callback<T> = void Function(T result);
|
|
|
|
|
/// failure.
|
|
|
|
|
typedef _Callbacker<T> = String? Function(_Callback<T?> callback);
|
|
|
|
|
|
|
|
|
|
/// Converts a method that receives a value-returning callback to a method that
|
|
|
|
|
/// returns a Future.
|
|
|
|
|
///
|
|
|
|
|
/// Return a [String] to cause an [Exception] to be synchronously thrown with
|
|
|
|
|
/// that string as a message.
|
|
|
|
|
///
|
|
|
|
|
/// If the callback is called with null, the future completes with an error.
|
|
|
|
|
///
|
|
|
|
|
/// Example usage:
|
|
|
|
|
///
|
|
|
|
|
/// ```dart
|
|
|
|
|
/// typedef IntCallback = void Function(int result);
|
|
|
|
|
///
|
|
|
|
|
/// String _doSomethingAndCallback(IntCallback callback) {
|
|
|
|
|
/// Timer(Duration(seconds: 1), () { callback(1); });
|
|
|
|
|
/// }
|
|
|
|
|
///
|
|
|
|
|
/// Future<int> doSomething() {
|
|
|
|
|
/// return _futurize(_doSomethingAndCallback);
|
|
|
|
|
/// }
|
|
|
|
|
/// ```
|
|
|
|
|
// Note: this function is not directly tested so that it remains private, instead an exact
|
|
|
|
|
// copy of it has been inlined into the test at lib/ui/fixtures/ui_test.dart. if you change
|
|
|
|
|
// this function, then you must update the test.
|
|
|
|
|
// Converts a method that receives a value-returning callback to a method that
|
|
|
|
|
// returns a Future.
|
|
|
|
|
//
|
|
|
|
|
// Return a [String] to cause an [Exception] to be synchronously thrown with
|
|
|
|
|
// that string as a message.
|
|
|
|
|
//
|
|
|
|
|
// If the callback is called with null, the future completes with an error.
|
|
|
|
|
//
|
|
|
|
|
// Example usage:
|
|
|
|
|
//
|
|
|
|
|
// ```dart
|
|
|
|
|
// typedef IntCallback = void Function(int result);
|
|
|
|
|
//
|
|
|
|
|
// String? _doSomethingAndCallback(IntCallback callback) {
|
|
|
|
|
// Timer(const Duration(seconds: 1), () { callback(1); });
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Future<int> doSomething() {
|
|
|
|
|
// return _futurize(_doSomethingAndCallback);
|
|
|
|
|
// }
|
|
|
|
|
// ```
|
|
|
|
|
//
|
|
|
|
|
// This function is private and so not directly tested. Instead, an exact copy of it
|
|
|
|
|
// has been inlined into the test at lib/ui/fixtures/ui_test.dart. if you change this
|
|
|
|
|
// function, then you must update the test.
|
|
|
|
|
//
|
|
|
|
|
// TODO(ianh): We should either automate the code duplication or just make it public.
|
|
|
|
|
Future<T> _futurize<T>(_Callbacker<T> callbacker) {
|
|
|
|
|
final Completer<T> completer = Completer<T>.sync();
|
|
|
|
|
// If the callback synchronously throws an error, then synchronously
|
|
|
|
|
|