我正在尝试将 path_provider 注册为依赖项,但它现在可以正常工作。
@preResolve
Future<Directory> get appDirectory => getExternalStorageDirectory();
但错误说A value of type 'Future<Directory?>' can't be returned from the function 'appDirectory' because it has a return type of 'Future<Directory>'
所以我这样改了
@preResolve
Future<Directory?> get appDirectory => getExternalStorageDirectory();
在此之后,我得到一个运行时错误
Error: Type argument 'Directory?' doesn't conform to the bound 'Object' of the type variable 'T' on 'GetItHelper.lazySingletonAsync'.
我该如何解决这个问题?