ソースを参照

Kill the background isolate

vishnukvmd 3 年 前
コミット
bc76b1033b
1 ファイル変更2 行追加0 行削除
  1. 2 0
      lib/main.dart

+ 2 - 0
lib/main.dart

@@ -1,4 +1,5 @@
 import 'dart:async';
+import 'dart:isolate';
 
 import 'package:background_fetch/background_fetch.dart';
 import 'package:flutter/foundation.dart';
@@ -222,6 +223,7 @@ Future<void> _killBGTask(String taskId) async {
   final prefs = await SharedPreferences.getInstance();
   prefs.remove(kLastBGTaskHeartBeatTime);
   BackgroundFetch.finish(taskId);
+  Isolate.current.kill(priority: Isolate.immediate);
 }
 
 class EnteApp extends StatefulWidget {