From 7969f54d3baae81a2ea378fd17b5cc708b47a91e Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 28 Nov 2019 19:54:22 +0000 Subject: [PATCH] Fix MissedPluginException for workmanager --- lib/main.dart | 5 ----- lib/pages/main.page.dart | 6 +++++- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 30f107f..c600937 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -176,12 +176,7 @@ void main() async { }; runZoned(() { - workManager.Workmanager.initialize( - updateDeviceLocationIsolate, - isInDebugMode: false - ); runApp(new HAClientApp()); - }, onError: (error, stack) { _reportError(error, stack); }); diff --git a/lib/pages/main.page.dart b/lib/pages/main.page.dart index e65868a..3d309df 100644 --- a/lib/pages/main.page.dart +++ b/lib/pages/main.page.dart @@ -30,12 +30,16 @@ class _MainPageState extends ReceiveShareState with WidgetsBindingObse @override void initState() { + super.initState(); final Stream purchaseUpdates = InAppPurchaseConnection.instance.purchaseUpdatedStream; _subscription = purchaseUpdates.listen((purchases) { _handlePurchaseUpdates(purchases); }); - super.initState(); + workManager.Workmanager.initialize( + updateDeviceLocationIsolate, + isInDebugMode: false + ); enableShareReceiving(); WidgetsBinding.instance.addObserver(this); diff --git a/pubspec.yaml b/pubspec.yaml index b74b5e2..85a04ab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: device_info: ^0.4.0+3 flutter_local_notifications: ^0.8.4 geolocator: ^5.1.5 - workmanager: ^0.1.3 + workmanager: ^0.1.5 battery: ^0.3.1+1 sentry: ^2.3.1 share: