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

 

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

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

今すぐ無料お試しキットを受け取る

はじめての方へ


みんプロ式プログラミング講座体系・ラインナップ
みんプロ式プログラミング講座受講の流れ(割引特典利用方法)
サイトマップ(みんプロHPコンテンツ一覧)
運営会社概要

みんプロ作成アプリ





今すぐ無料お試しキットを受け取る
TOP