Flutter The method 'File.create' has fewer named arguments than those of overridden method 'File.create'

Flutter frequently come with minor or major changes these changes may affect our existing project or not. Recently I upgraded to Flutter 3.7.1. But When I ran my project then what I saw in the console "The method 'File.create' has fewer named arguments than those of overridden method 'File.create'". In this post will see how to easily solve this problem.

Error :

../../../.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 create({bool recursive = false});

 

Cause of error:

When we upgrade Flutter 3.7 then this error occurs due to the older File version of Dart

Solution:

We can solve this error by updating the File package. Just add the latest File package in the project like the below:

dependencies:
  file: ^6.1.4

 

Finally, run your project, and your project it will run successfully.

Tags: