【お知らせ】みんプロ式Flutter講座は2026年4月末をもって新規販売を終了いたします。詳しくはこちら →

FlutterのSDKをアップグレードしてビルドすると「The method ‘File.create’ has fewer named arguments than those of overridden method ‘File.create’.」というエラーが出て失敗する場合の対処法

このページには広告が含まれる場合があります。

 

FlutterのSDKをアップグレードして、プロジェクトをビルドすると、

(FlutterSDKのアップグレード方法はこちらから)

アップグレード前はちゃんとビルドできていたのに、アップグレード後は

The method ‘File.create’ has fewer named arguments than those of overridden method ‘File.create’.・・・

というエラーが出て失敗する場合があります。

../../../../.pub-cache/hosted/pub.dev/file-6.1.2/lib/src/interface/file.dart:15:16: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create'.
  Future<File> create({bool recursive = false});
               ^
org-dartlang-sdk:///third_party/dart/sdk/lib/io/file.dart:232:16: Context: This is the overridden method ('create').
  Future<File> create({bool recursive = false, bool exclusive = false});
               ^
../../../../.pub-cache/hosted/pub.dev/file-6.1.2/lib/src/interface/file.dart:15:16: Error: The method 'File.create' doesn't have the named parameter 'exclusive' of overridden method 'File.create'.
  Future<File> create({bool recursive = false});

・・・

その場合は、

1)pubspec.lockファイル(「yaml」じゃない方)を削除して、

 

2)pubspec.yamlファイルから再度「pub get」すると解消します。

 

(詳しくは、以下の動画で解説していますので、よろしければご覧ください(発生原因についても言及しています))

こんな記事も読まれています

みんプロ作成アプリ





TOP