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」すると解消します。

 

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

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

人気No.1

前向きな気持ちになれる 占星術・タロットリーディング

あすコロ式・相談サロン 【ナビるやん】

人に言えない悩みから使命・運勢診断まで、あなたに寄り添いながら“ナビゲート”する、あすコロ人気No.1のオンライン相談サロン。占星術・心理学・タロットの叡智を活かし、普段認識していない「潜在意識」にアクセスしてあなたの気づいていない可能性を拓かせ、明日から前向きに歩めるようになる60分のリーディングセッション。

今すぐ詳細を見る(メルマガ登録で初回半額) ▶

TOP