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

 

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

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

【無料】生年月日を入力するだけ!

あなたの知らない「あなた」がわかる
無料診断ツール

あすコロ式
使命・性格タイプ診断

生年月日を入力するだけで144通りの性格パターンを診断。あなたの知らない「本当のあなた(生きる目的・使命)」と「偽りのあなた(無意識の思いグセ)」がわかります!

今すぐ無料で診断する ▶

TOP