はじめに
flutter_launcher_icons
を使ってアイコンを生成しようと思った時、以下のようなエラーがでてきてしましました。
(base) HanachirunoMacBook-Pro:templete_mail_app hanachiru$ flutter pub pub run flutter_launcher_icons:main Failed to precompile flutter_launcher_icons:main: ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:164:45: Error: Getter not found: 'AVERAGE'. newFile = copyResize(image, e.size, -1, AVERAGE); ^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:164:25: Error: Too many positional arguments: 1 allowed, but 4 found. Try removing the extra positional arguments. newFile = copyResize(image, e.size, -1, AVERAGE); ^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.4/lib/src/transform/copy_resize.dart:14:7: Context: Found this candidate, but the arguments don't match. Image copyResize(Image src, {int width, int height, ^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:166:45: Error: Getter not found: 'LINEAR'. newFile = copyResize(image, e.size, -1, LINEAR); ^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:166:25: Error: Too many positional arguments: 1 allowed, but 4 found. Try removing the extra positional arguments. newFile = copyResize(image, e.size, -1, LINEAR); ^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.4/lib/src/transform/copy_resize.dart:14:7: Context: Found this candidate, but the arguments don't match. Image copyResize(Image src, {int width, int height, ^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:176:49: Error: Getter not found: 'AVERAGE'. newFile = copyResize(image, e.size, e.size, AVERAGE); ^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:176:25: Error: Too many positional arguments: 1 allowed, but 4 found. Try removing the extra positional arguments. newFile = copyResize(image, e.size, e.size, AVERAGE); ^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.4/lib/src/transform/copy_resize.dart:14:7: Context: Found this candidate, but the arguments don't match. Image copyResize(Image src, {int width, int height, ^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.6.1/lib/android.dart:178:49: Error: Getter not found: 'LINEAR'. newFile = copyResize(image, e.size, e.size, LINEAR); ^^^^^^ pub finished with exit code 1
これの対処法を見つけられたので、書き残しておきたいと思います。
対処法
pubspec.yaml
に以下のコードを付け足してください。
dependency_overrides: image: 2.0.7
さいごに
なかなかこの解決法を見つけるまで大変で諦めたくなりましたが、無事解決できて良かったです。
もし似たエラーで悩んでいるかたがいれば試してみてがいかがででしょうか。
ではまた。