Flutter plugin: InAppPurchasePlugin.java uses unchecked or unsafe operations

4,710

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.

Share:
4,710
Tanzim Hasan Fahim
Author by

Tanzim Hasan Fahim

Updated on December 12, 2022

Comments

  • Tanzim Hasan Fahim
    Tanzim Hasan Fahim over 1 year

    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.
    
  • Sisir
    Sisir over 3 years
    "This is just a warning, not an error" is not a very good philosphy to foollow. THe compiler generates an warning because there is a potential problem which may not break your app right away but may become a bottoleneck in future.