Kras
Kras

Reputation: 101

Flutter isolate not working in release mode on Android?

I have an app, which uses flutter isolate to show local notifications. This seems to work perfectly in debug mode and even in release mode pushed via "flutter run --release --verbose" with attached real device. However, when released to Play Store, the app as such works, but the isolate is never spawned - no notifications, also no exceptions or crashes. Simply... nothing.

Any ides what could cause such a behavior? What could case a isolate not to run? Again - in debug mode same code works like a charm...

Upvotes: 1

Views: 1963

Answers (2)

Ahmed tharwat
Ahmed tharwat

Reputation: 21

use screen utils package in add

await ScreenUtil.ensureScreenSize()
*in main *

Upvotes: 0

MarcoB
MarcoB

Reputation: 170

Maybe while building your .aab the compiler shrink or obfuscate some resources it thinks they are not used. I think you have a callback function running on a separate isolate. So you can try to add something like this:

    @pragma('vm:entry-point')
    myCallback() {...}

this forces the compiler to keep that function. You can also try to add to android.buildTypes.release in app/build.gradle:

     shrinkResources false
     minifyEnabled false

Upvotes: 7

Related Questions