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

Fluttertoast.showToast( msg: 'Success', toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.CENTER, backgroundColor: Colors.green, textColor: Colors.white, fontSize: 16.0, );

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

2

There are 2 best solutions below

0
MendelG On

Well, the problem has to do with the package (flutterToast ) that you're using.

If you inspect the source code. You'll see that they're using webOnlyAssetManager:

enter image description here

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

which is deprecated. You'll have to wait for the package maintainer to release a new version.

0
Renato Manocchio Barbosa On

To fix this problem you may change flutter toast_web.dart inside your project (Your Project/External Library/Dart Packages).

Include:

import 'dart:ui_web'

And change:

From

ui.webOnlyAssetManager.getAssetUrl('...')

To

Uri.encodeFull('...')

But, this will be reset to original code if you update the Flutter.