Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 提供程序没有作用域,声明后访问错误_Flutter_Google Cloud Platform_Firebase Authentication_Flutter Provider - Fatal编程技术网

Flutter 提供程序没有作用域,声明后访问错误

Flutter 提供程序没有作用域,声明后访问错误,flutter,google-cloud-platform,firebase-authentication,flutter-provider,Flutter,Google Cloud Platform,Firebase Authentication,Flutter Provider,我正在我的移动应用程序上完成身份验证流程,现在是注册时间,所以用户应该插入其数据(姓名、年龄…),但我收到错误提供商不在范围内,因此我无法使用FirestoreDatabase功能。这是所有应用程序流中提供商的第一个声明,我想我没有正确地阅读它,可能是上下文造成的问题 首先显示代码,这是如何定义数据库类的: class FirestoreDatabase implements Database{//...some functions 现在代码是: Widget build(BuildConte

我正在我的移动应用程序上完成身份验证流程,现在是注册时间,所以用户应该插入其数据(姓名、年龄…),但我收到错误
提供商不在范围内
,因此我无法使用
FirestoreDatabase
功能。这是所有应用程序流中
提供商的第一个声明,我想我没有正确地阅读它,可能是
上下文
造成的问题

首先显示代码,这是如何定义
数据库
类的:

class FirestoreDatabase implements Database{//...some functions
现在代码是:

Widget build(BuildContext context) {
    return Provider<Database>( //Database is an interface to use FirebaseFirestore class methods and other
      create: (context) => FirestoreDatabase(uid: widget.userUid),
      child: Scaffold(...
我想问题是关于
上下文
或者我在最后几行声明了
数据库
类型的变量

Future<void> _submit() async {
    if (_validateAndSaveForm()) {
      Database database = Provider.of<Database>(context, listen: false);
      database.(some functions)