Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.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
Android 以下StackOverflower错误在building _BodyBuilder中被抛出:Firebase.initializeApp()之后的堆栈溢出_Android_Firebase_Flutter_Dart_Google Cloud Firestore - Fatal编程技术网

Android 以下StackOverflower错误在building _BodyBuilder中被抛出:Firebase.initializeApp()之后的堆栈溢出

Android 以下StackOverflower错误在building _BodyBuilder中被抛出:Firebase.initializeApp()之后的堆栈溢出,android,firebase,flutter,dart,google-cloud-firestore,Android,Firebase,Flutter,Dart,Google Cloud Firestore,firebase升级后,我可以看到firebase core是强制性的,因此我相应地修改了代码,但不知道initializeApp函数,因此我在互联网上搜索了这一点,并添加了这一行Wait firebase.initializeApp()但是现在我得到了这个错误 W/DynamiteModule(20840): Local module descriptor class for providerinstaller not found. I/DynamiteModule(20840): Consi

firebase升级后,我可以看到firebase core是强制性的,因此我相应地修改了代码,但不知道initializeApp函数,因此我在互联网上搜索了这一点,并添加了这一行
Wait firebase.initializeApp()但是现在我得到了这个错误

W/DynamiteModule(20840): Local module descriptor class for providerinstaller not found.
I/DynamiteModule(20840): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller(20840): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
W/ConnectivityManager.CallbackHandler(20840): callback not found for CALLBACK_AVAILABLE message

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following StackOverflowError was thrown building _BodyBuilder:
Stack Overflow

The relevant error-causing widget was: 
  Scaffold file:///Users/masummolla/FlutterProjects/admin/lib/screens/active_user.dart:32:12
When the exception was thrown, this was the stack: 
#0      _StringBase.== (dart:core-patch/string_patch.dart:280:7)
#1      _LinkedHashMapMixin._getValueOrData (dart:collection-patch/compact_hash.dart:670:10695)
#2      new FirestoreService (package:admin/services/firestore_service.dart:129:7844)
#3      new FirestoreService (package:admin/services/firestore_service.dart:8:27)
#4      new FirestoreService (package:admin/services/firestore_service.dart:8:27)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following StackOverflowError was thrown building _BodyBuilder:
Stack Overflow

The relevant error-causing widget was: 
  Scaffold file:///Users/masummolla/FlutterProjects/admin/lib/screens/active_user.dart:32:12
When the exception was thrown, this was the stack: 
#0      _StringBase.== (dart:core-patch/string_patch.dart:280:7)
#1      _LinkedHashMapMixin._getValueOrData (dart:collection-patch/compact_hash.dart:670:10695)
#2      new FirestoreService (package:admin/services/firestore_service.dart:129:7844)
#3      new FirestoreService (package:admin/services/firestore_service.dart:8:27)
#4      new FirestoreService (package:admin/services/firestore_service.dart:8:27)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
我不知道确切的原因

这是我在main.dart文件中的代码

import 'package:admin/models/route_generator.dart';
import 'package:admin/user_preferences.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await UserPreferences().init();
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.amber,

        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      // ignore: unrelated_type_equality_checks
      onGenerateRoute: RouteGenerator.generateRoute,
      initialRoute: '/',


    );
  }
}
import 'package:admin/screens/class_videos.dart';
import 'package:admin/screens/important_videos.dart';
import 'package:admin/screens/live_class.dart';
import 'package:admin/screens/user_details.dart';
import 'package:admin/screens/weekly_updates.dart';
import 'package:admin/user_preferences.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class ActiveUser extends StatefulWidget {
  @override
  _ActiveUserState createState() => _ActiveUserState();
}

class _ActiveUserState extends State<ActiveUser> {

  int landing = 2;
  int _page = 2;
  @override
  void initState(){
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown,DeviceOrientation.portraitUp]);
    super.initState();
    landing = UserPreferences().landing;
    _page=landing;
  }

  final pageScreen = [ImportantVideos(),WeeklyUpdates(),ClassVideos(),LiveClass(),UserDetails()];
  GlobalKey _bottomNavigationKey = GlobalKey();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Badshai Trading Videos'),
        actions: [
          IconButton(
            icon: _page==landing ? Icon(Icons.touch_app,color: Colors.white,) :Icon(Icons.pan_tool,color: Colors.white,),
            onPressed: () {
              if (_page!=landing){
                UserPreferences().landing=_page;
                setState(() {
                  landing=_page;
                });
              }else if(_page==landing && _page!=2){
                setState(() {
                  landing = 2;
                  UserPreferences().landing=landing;
                });

              }
            },
          ),
        ],
      ),
      body: pageScreen[_page],
      bottomNavigationBar: CurvedNavigationBar(
        key: _bottomNavigationKey,
        index: _page,
        height: 50.0,
        items: <Widget>[
          Icon(Icons.important_devices, size: 20,color: _page==0 ?Colors.amber:Colors.black,),
          Icon(Icons.multiline_chart, size: 20,color: _page==1 ?Colors.amber:Colors.black,),
          Icon(Icons.live_tv, size: 20,color: _page==2 ?Colors.amber:Colors.black,),
          Icon(Icons.card_membership, size: 20,color: _page==3 ?Colors.amber:Colors.black,),
          Icon(Icons.more, size: 20,color: _page==4 ?Colors.amber:Colors.black,),
        ],
        color: Colors.white,
        buttonBackgroundColor: Colors.white,
        backgroundColor: Colors.amberAccent,
        animationCurve: Curves.easeInOut,
        animationDuration: Duration(milliseconds: 400),
        onTap: (index) {
          setState(() {
            _page = index;
          });
        },
      ),
    );
  }
}
import'包:admin/models/route_generator.dart';
导入“package:admin/user_preferences.dart”;
导入“包:firebase_core/firebase_core.dart”;
进口“包装:颤振/材料.省道”;
void main()异步{
WidgetsFlutterBinding.ensureInitialized();
等待Firebase.initializeApp();
等待UserPreferences().init();
runApp(MyApp());
}
类MyApp扩展了StatefulWidget{
//此小部件是应用程序的根。
@凌驾
_MyAppState createState()=>\u MyAppState();
}
类MyAppState扩展了状态{
@凌驾
小部件构建(构建上下文){
返回材料PP(
标题:“颤振演示”,
debugShowCheckedModeBanner:false,
主题:主题数据(
主样本:颜色。琥珀色,
视觉密度:视觉密度。自适应平台密度,
),
//忽略:不相关的\u类型\u相等\u检查
onGenerateRoute:RouteGenerator.generateRoute,
initialRoute:“/”,
);
}
}
下面是激活的_user.dart文件的代码

import 'package:admin/models/route_generator.dart';
import 'package:admin/user_preferences.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await UserPreferences().init();
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.amber,

        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      // ignore: unrelated_type_equality_checks
      onGenerateRoute: RouteGenerator.generateRoute,
      initialRoute: '/',


    );
  }
}
import 'package:admin/screens/class_videos.dart';
import 'package:admin/screens/important_videos.dart';
import 'package:admin/screens/live_class.dart';
import 'package:admin/screens/user_details.dart';
import 'package:admin/screens/weekly_updates.dart';
import 'package:admin/user_preferences.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class ActiveUser extends StatefulWidget {
  @override
  _ActiveUserState createState() => _ActiveUserState();
}

class _ActiveUserState extends State<ActiveUser> {

  int landing = 2;
  int _page = 2;
  @override
  void initState(){
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown,DeviceOrientation.portraitUp]);
    super.initState();
    landing = UserPreferences().landing;
    _page=landing;
  }

  final pageScreen = [ImportantVideos(),WeeklyUpdates(),ClassVideos(),LiveClass(),UserDetails()];
  GlobalKey _bottomNavigationKey = GlobalKey();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Badshai Trading Videos'),
        actions: [
          IconButton(
            icon: _page==landing ? Icon(Icons.touch_app,color: Colors.white,) :Icon(Icons.pan_tool,color: Colors.white,),
            onPressed: () {
              if (_page!=landing){
                UserPreferences().landing=_page;
                setState(() {
                  landing=_page;
                });
              }else if(_page==landing && _page!=2){
                setState(() {
                  landing = 2;
                  UserPreferences().landing=landing;
                });

              }
            },
          ),
        ],
      ),
      body: pageScreen[_page],
      bottomNavigationBar: CurvedNavigationBar(
        key: _bottomNavigationKey,
        index: _page,
        height: 50.0,
        items: <Widget>[
          Icon(Icons.important_devices, size: 20,color: _page==0 ?Colors.amber:Colors.black,),
          Icon(Icons.multiline_chart, size: 20,color: _page==1 ?Colors.amber:Colors.black,),
          Icon(Icons.live_tv, size: 20,color: _page==2 ?Colors.amber:Colors.black,),
          Icon(Icons.card_membership, size: 20,color: _page==3 ?Colors.amber:Colors.black,),
          Icon(Icons.more, size: 20,color: _page==4 ?Colors.amber:Colors.black,),
        ],
        color: Colors.white,
        buttonBackgroundColor: Colors.white,
        backgroundColor: Colors.amberAccent,
        animationCurve: Curves.easeInOut,
        animationDuration: Duration(milliseconds: 400),
        onTap: (index) {
          setState(() {
            _page = index;
          });
        },
      ),
    );
  }
}
import'包:admin/screens/class_videos.dart';
导入“package:admin/screens/important_videos.dart”;
导入“包:admin/screens/live_class.dart”;
导入“包:admin/screens/user_details.dart”;
导入“package:admin/screens/weekly_updates.dart”;
导入“package:admin/user_preferences.dart”;
导入“包:弧形导航栏/弧形导航栏.省道”;
进口“包装:颤振/材料.省道”;
导入“包:flifter/services.dart”;
类ActiveUser扩展StatefulWidget{
@凌驾
_ActiveUserState createState()=>\u ActiveUserState();
}
类_ActiveUserState扩展了状态{
int着陆=2;
int_page=2;
@凌驾
void initState(){
SystemChrome.setPreferredOrientations([DeviceOrientation.GraphitalDown,DeviceOrientation.GraphitalUp]);
super.initState();
landing=UserPreferences()。landing;
_页面=登陆;
}
最终页面屏幕=[ImportantVideos()、WeeklyUpdates()、ClassVideos()、LiveClass()、UserDetails()];
GlobalKey _bottomNavigationKey=GlobalKey();
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
标题:文本(“Badshai交易视频”),
行动:[
图标按钮(
图标:_page==登陆?图标(Icons.touch_应用程序,颜色:Colors.white,):图标(Icons.pan_工具,颜色:Colors.white,),
已按下:(){
如果(_page!=着陆){
UserPreferences().landing=\u页面;
设置状态(){
登陆=_页面;
});
}如果(_page==landing&&u page!=2),则为else{
设置状态(){
着陆=2;
UserPreferences().landing=landing;
});
}
},
),
],
),
正文:页面屏幕[_页面],
底部导航栏:曲线导航栏(
键:_bottomNavigationKey,
索引:_页,
身高:50.0,
项目:[
图标(Icons.important_设备,大小:20,颜色:_page==0?颜色。琥珀色:颜色。黑色,),
图标(Icons.multiline_图表,大小:20,颜色:页面==1?颜色。琥珀色:颜色。黑色,),
图标(Icons.live\u tv,尺寸:20,颜色:\u页面==2?颜色。琥珀色:颜色。黑色,),
图标(Icons.card_会员资格,尺寸:20,颜色:页面==3?颜色。琥珀色:颜色。黑色,),
图标(Icons.more,大小:20,颜色:_page==4?颜色。琥珀色:颜色。黑色,),
],
颜色:颜色,白色,
按钮背景颜色:Colors.white,
背景颜色:Colors.amberAccent,
动画曲线:Curves.easeInOut,
animationDuration:持续时间(毫秒:400),
onTap:(索引){
设置状态(){
_页面=索引;
});
},
),
);
}
}

如果有人能帮我摆脱这一困境,我会感谢他们的

对不起,我得到了FirestoreService使用过的bug\u ndb=FirestoreService()我的FirestoreService类中的这一行,刚刚对其进行了注释