From 585a7a06fdf8d89c557690da3b021f63073b4264 Mon Sep 17 00:00:00 2001 From: Chun-Heng Tai Date: Thu, 16 Jan 2020 13:29:39 -0800 Subject: [PATCH] clean up future chain --- lib/ui/text.dart | 4 ++-- lib/web_ui/lib/src/ui/text.dart | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 1fe24811df76d..a2904128194cc 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -2123,14 +2123,14 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 { Future loadFontFromList(Uint8List list, {String fontFamily}) { return _futurize( (_Callback callback) => _loadFontFromList(list, callback, fontFamily) - ).then(_sendFontChangeMessage); + ).then((_) => _sendFontChangeMessage()); } final ByteData _fontChangeMessage = utf8.encoder.convert( json.encode({'type': 'fontsChange'}) ).buffer.asByteData(); -FutureOr _sendFontChangeMessage(void result) async { +FutureOr _sendFontChangeMessage() async { if (window.onPlatformMessage != null) window.onPlatformMessage( 'flutter/system', diff --git a/lib/web_ui/lib/src/ui/text.dart b/lib/web_ui/lib/src/ui/text.dart index f3b64e9882b38..6b57d37f2f168 100644 --- a/lib/web_ui/lib/src/ui/text.dart +++ b/lib/web_ui/lib/src/ui/text.dart @@ -1498,12 +1498,14 @@ abstract class ParagraphBuilder { /// * `fontFamily`: The family name used to identify the font in text styles. /// If this is not provided, then the family name will be extracted from the font file. Future loadFontFromList(Uint8List list, {String fontFamily}) { - return _fontCollection.loadFontFromList(list, fontFamily: fontFamily).then(_sendFontChangeMessage); + return _fontCollection.loadFontFromList(list, fontFamily: fontFamily).then( + (_) => _sendFontChangeMessage() + ); } final ByteData _fontChangeMessage = engine.JSONMessageCodec().encodeMessage({'type': 'fontsChange'}); -FutureOr _sendFontChangeMessage(void result) async { +FutureOr _sendFontChangeMessage() async { if (window.onPlatformMessage != null) window.onPlatformMessage( 'flutter/system',