#782 dispose flutter engine from analysis worker
This commit is contained in:
parent
01802f8aaa
commit
0b95c80356
1 changed files with 12 additions and 1 deletions
|
@ -45,11 +45,22 @@ class AnalysisWorker(context: Context, parameters: WorkerParameters) : Coroutine
|
||||||
workCont = cont
|
workCont = cont
|
||||||
onStart()
|
onStart()
|
||||||
}
|
}
|
||||||
|
dispose()
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun dispose() {
|
||||||
|
Log.i(LOG_TAG, "Clean analysis worker $id")
|
||||||
|
flutterEngine?.let {
|
||||||
|
FlutterUtils.runOnUiThread {
|
||||||
|
it.destroy()
|
||||||
|
}
|
||||||
|
flutterEngine = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun onStart() {
|
private fun onStart() {
|
||||||
Log.i(LOG_TAG, "Start analysis worker")
|
Log.i(LOG_TAG, "Start analysis worker $id")
|
||||||
runBlocking {
|
runBlocking {
|
||||||
FlutterUtils.initFlutterEngine(applicationContext, SHARED_PREFERENCES_KEY, CALLBACK_HANDLE_KEY) {
|
FlutterUtils.initFlutterEngine(applicationContext, SHARED_PREFERENCES_KEY, CALLBACK_HANDLE_KEY) {
|
||||||
flutterEngine = it
|
flutterEngine = it
|
||||||
|
|
Loading…
Reference in a new issue