From 7f21c2cf0a658b06b2fde58b75fb9275e37a4e46 Mon Sep 17 00:00:00 2001 From: Jiaming Cheng Date: Tue, 1 Oct 2019 18:57:27 -0700 Subject: [PATCH 1/2] Cast type --- packages/phone_log/lib/phone_log.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/phone_log/lib/phone_log.dart b/packages/phone_log/lib/phone_log.dart index d4f9e75..48ab16e 100644 --- a/packages/phone_log/lib/phone_log.dart +++ b/packages/phone_log/lib/phone_log.dart @@ -34,7 +34,7 @@ class PhoneLog { /// Request a [permission] and return a [Future] of bool. Future requestPermission() async { final bool isGranted = - await _channel.invokeMethod("requestPermission", null); + await _channel.invokeMethod("requestPermission", null); return isGranted; } @@ -46,10 +46,12 @@ class PhoneLog { {Int64 startDate, Int64 duration}) async { final String _startDate = startDate?.toString(); final String _duration = duration?.toString(); - final Iterable> records = await _channel.invokeMethod( - 'getPhoneLogs', - {"startDate": _startDate, "duration": _duration}); - return records?.map((Map m) => new CallRecord.fromMap(m)); + + final Iterable records = (await _channel.invokeMethod('getPhoneLogs', + {"startDate": _startDate, "duration": _duration})) + .cast(); + return records + ?.map((m) => new CallRecord.fromMap(m.cast())); } } @@ -89,4 +91,4 @@ class CallRecord { dateSecond = m['dateSecond']; duration = m['duration']; } -} +} \ No newline at end of file From bbff7e81354f4e2931fb197b3e97e0afb5269929 Mon Sep 17 00:00:00 2001 From: Jiaming Cheng Date: Wed, 2 Oct 2019 15:20:45 -0700 Subject: [PATCH 2/2] fix indent --- packages/phone_log/lib/phone_log.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/phone_log/lib/phone_log.dart b/packages/phone_log/lib/phone_log.dart index 48ab16e..d87ebf2 100644 --- a/packages/phone_log/lib/phone_log.dart +++ b/packages/phone_log/lib/phone_log.dart @@ -34,7 +34,7 @@ class PhoneLog { /// Request a [permission] and return a [Future] of bool. Future requestPermission() async { final bool isGranted = - await _channel.invokeMethod("requestPermission", null); + await _channel.invokeMethod("requestPermission", null); return isGranted; }