【flutter】モバイルアイコンを設定する際のエラー対処方法

flutter_launcher_icons設定

pubspec.yaml

dev_dependencies:
  flutter_launcher_icons: ^0.7.0
flutter_icons:
  image_path: "assets/images/icon.png"
  ios: true
  android: true

flutter_launcher_iconsを使いアプリアイコンを設定したところ下記エラーが出ました。

flutter_launcher_icflutter packages pub run flutter_launcher_icons:main

Failed to precompile flutter_launcher_icons:main:
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:207:45: Error: Getter not found: 'AVERAGE'.
  newFile = copyResize(image, e.size, -1, AVERAGE);
                                          ^^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:207:25: Error: Too many positional arguments: 1 allowed, but 4 found.
Try removing the extra positional arguments.
  newFile = copyResize(image, e.size, -1, AVERAGE);
                      ^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.1/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,
    ^^^^^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:209:45: Error: Getter not found: 'LINEAR'.
  newFile = copyResize(image, e.size, -1, LINEAR);
                                          ^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:209:25: Error: Too many positional arguments: 1 allowed, but 4 found.
Try removing the extra positional arguments.
  newFile = copyResize(image, e.size, -1, LINEAR);
                      ^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.1/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,
    ^^^^^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:223:63: Error: Getter not found: 'AVERAGE'.
  newFile = copyResize(image, template.size, template.size, AVERAGE);
                                                            ^^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:223:25: Error: Too many positional arguments: 1 allowed, but 4 found.
Try removing the extra positional arguments.
  newFile = copyResize(image, template.size, template.size, AVERAGE);
                      ^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.1/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,
    ^^^^^^^^^^
file:///Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.7.0/lib/android.dart:226:63: Error: Getter not found: 'LINEAR'.
  newFile = copyResize(image, template.size, template.size, LINEAR);

pub finished with exit code 1

対象方法

pubspec.yaml

dependency_overrides:
  image: 2.0.7

を追加することでエラーが解消出来ました。


この記事が気に入ったらサポートをしてみませんか?