From 90c2f817201047aaaf29947dc0a9e818d8f687bc 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 eec5be4cec804..f6aa25b23bf3e 100644 --- a/lib/web_ui/lib/src/ui/text.dart +++ b/lib/web_ui/lib/src/ui/text.dart @@ -1490,12 +1490,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',