Flag Immutable and Flag Mutable in Flutter

Updated 27 October 2023

Save

Hi, today we will check one of the most common gradle issues with Flag Immutable and Flag Mutable In Flutter.

Problem Statement

You will see the below error statement on your console:-

ava.lang.IllegalArgumentException: bundleId: Targeting S+ (version 31 and above) requires that one of Flag Immutable and Flag Mutable be specified when creating a PendingIntent.

W/System.err( 9990): Strongly consider using Flag Immutable, only use Flag Mutable if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Cause of Problem

This is the flutter gradle issue and can pop on many occasions. Some common occasions are when you try to perform some task like notification on the device with API level 31 or above. i.e. Android 12 or above.

If you’re encountering this issue in a Flutter app, it means that you need to make sure that you specify one of these flags when creating a PendingIntent in your Android-specific code (usually located in the android directory of your Flutter project).

Learn more about our Flutter Development Services.

Solution

Now, the main question is how to resolve this issue.

While solving this issue you need to consider the below point carefully and follow the instructions on it:-

“W/System.err( 9990): Strongly consider using Flag Immutable, only use Flag Mutable if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.”

Here you will need to change the Flag Mutability and Pending Intent in your project.

You can set your pending intent and Flag Mutability as below:-

Conclusion

In this blog, we have checked one of the most common gradle error popups, with the Flutter applications.

Thanks for reading this blog. You can also check out more amazing blogs on Flutter with Mobikul blogs.

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home