android – Flutter plugin: InAppPurchasePlugin.java uses unchecked or unsafe operations-ThrowExceptions

Exception or error:

When i am trying to just add the in_app_purchase plugging in the apps pubspec.yaml file the following error is occurred.

Just after adding the plugin. not related to any specific code.

Note: /Users/tanzimfahim/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.2.0+3/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
How to solve:

Unchecked or unsafe operations

When adding plugins to Flutter and running your app on Android, you will often see warnings. The “unchecked or unsafe operations” warning is very common.

They are fine

You do not have to worry about it because:

  • This is just a warning, not an error. These warnings will only appear when you compile the plugin for the first time, i.e. every time you use flutter clean or add a new plugin; generally when you compile a plugin for the first time.

  • Most plugins, certainly all Flutter favorites, are tested. If unchecked or unsafe operations are left in, the authors have determined that these operations are fine in their use case.

What can you do about them?

As I outlined above, you do not have to do anything about them.

What you can do is file an issue about it or create a pull request directly to either suppress the warning or find an alternative solution in code.

Leave a Reply

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