ponnamkarthik / FlutterToast

Toast Plugin for Flutter
MIT License
1.43k stars 349 forks source link

FlutterToast uses deprecated webOnlyAssetManager getter instead of assetManager from dart:ui_web #485

Open kevan-mtl opened 6 months ago

kevan-mtl commented 6 months ago

Hi everyone,

In the file fluttertoast_web.dart, the following lines use a deprecated API:

final jsUrl = ui.webOnlyAssetManager.getAssetUrl(
      'packages/fluttertoast/assets/toastify.js',
    );

Indeed, it's a deprecated method according to Flutter (at least on v3.16.3), see below warning message when running on web:

The webOnlyAssetManager getter is deprecated and will be removed in a future release. Please use `assetManager` from `dart:ui_web` instead.
JohnOwais commented 6 months ago
              Fluttertoast.showToast(
                msg: 'Success',
                toastLength: Toast.LENGTH_SHORT,
                gravity: ToastGravity.CENTER,
                backgroundColor: Colors.green,
                textColor: Colors.white,
                fontSize: 16.0,
              );

Warning: The webOnlyAssetManager getter is deprecated and will be removed in a future release. Please use assetManager from dart:ui_web instead.

amrgetment commented 4 months ago

@ponnamkarthik could you review the open PR so we don't get the warning while running on web Thanks in advance