easazade / android_long_task

android long task is a flutter plugin to run dart code in an android foreground service with simplicity
Apache License 2.0
16 stars 6 forks source link

Fix subtype errors #6

Closed Eimji closed 3 years ago

Eimji commented 3 years ago

Hello

Thanks for your Flutter plugin.

There are some subtype errors when running with thle latest Flutter version and Dart null safety mode enabled:

E/flutter (24246): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type 'Future<dynamic>' is not a subtype of type 'Future<String?>' in type cast
E/flutter (24246): #0      ServiceClient.stopService (package:android_long_task/long_task/service_client.dart:30)

E/flutter (18800): [ERROR:flutter/lib/ui/ui_dart_state.cc(213)] Unhandled Exception: type 'Null' is not a subtype of type 'Map<String, dynamic>'
E/flutter (18800): #0      AppClient.getData (package:android_long_task/long_task/app_client.dart:49)

The bug in app_client.dart is related to https://github.com/easazade/android-long-task/issues/5 I can see you fix, but I propose a better solution, which also works for service_client.dart

Thanks.

easazade commented 3 years ago

Hey There, Sorry for the late response. I will merge this thank you