-3

`

C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\wallpaper_manager-1.0.10\android\src\main\java\com\mulgundkar\wallpaper_manager\WallpaperManagerPlugin.java:129: error: cannot find symbol
                String assetLookupKey = FlutterLoader.getInstance().getLookupKeyForAsset(assetPath);
                                                     ^
  symbol:   method getInstance()
  location: class FlutterLoader
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\wallpaper_manager-1.0.10\android\src\main\java\com\mulgundkar\wallpaper_manager\WallpaperManagerPlugin.java:152: error: cannot find symbol
                String assetLookupKey = FlutterLoader.getInstance().getLookupKeyForAsset(assetPath);
                                                     ^

  symbol:   method getInstance()
  location: class FlutterLoader
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':wallpaper_manager:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

`

wallpaper_manager: any When I add the package, the project gives an error. There was no problem in the old versions of flutter, but the application does not work anymore, how should I proceed?

nbz
  • 1
  • 1

1 Answers1

0

If you look at the current javadocs for FlutterLoader, it doesn't declare a getInstance() method anymore. The method was deprecated and then removed.

According to https://stackoverflow.com/a/64456438/139985, since Flutter 1.22 you need to get hold of a FlutterLoader instance using FlutterInjector:

import io.flutter.FlutterInjector;
...
FlutterLoader loader = FlutterInjector.instance().flutterLoader();

See also: What does a "Cannot find symbol" or "Cannot resolve symbol" error mean?

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216