flutter / dart error: The argument type 'Future' can't be assigned to the parameter type 'File'

前端 未结 4 1705
时光说笑
时光说笑 2021-02-14 06:12

I\'m trying to build my first mobile application with flutter and firebase. When I try to display and store a photo I have the following issue :

error: T

4条回答
  •  遇见更好的自我
    2021-02-14 06:58

    For those who are still looking for answers, as it seems there are different reasons for the same error. In my case, it was the different import statement for a file which I was passing as parameters to a different function. It should be same file(import) in case of declaration and definition.

    for example, don't use like this in dart:

    import 'GitRepoResponse.dart';
    import 'GitRowItem.dart';
    

    and then in some another class

    import 'package:git_repo_flutter/GitRepoResponse.dart';
    import 'package:git_repo_flutter/GitRowItem.dart';
    

    because

    In Dart, two libraries are the same if, and only if, they are imported using the same URI. If two different URIs are used, even if they resolve to the same file, they will be considered to be two different libraries and the types within the file will occur twice

    Read more here

提交回复
热议问题