无法加载providerinstaller模块:找不到可接受的模块。本地版本为0,远程版本为0

时间:2020-10-13 21:52:43

标签: firebase flutter dart

我在运行控制台中收到此警告。基本上,我的chatRoomTile没有显示在屏幕上。即使我已经和10个人聊天,它也只是显示空白屏幕。

它只是显示主屏幕,红色容器显示2秒钟,如条件语句所示。

这是运行中的输出-

Performing hot restart...
Syncing files to device sdk gphone x86...
Restarted application in 1,522ms.
W/eyansh.whatsap( 6057): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)
W/DynamiteModule( 6057): Local module descriptor class for providerinstaller not found.
I/DynamiteModule( 6057): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller( 6057): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
Lost connection to device.

这是我的代码-

import 'package:flutter/material.dart';
import 'package:whatsapp/helper/authenticate.dart';
import 'package:whatsapp/helper/constants.dart';
import 'package:whatsapp/helper/helperFunctions.dart';
import 'package:whatsapp/screens/search.dart';
import 'package:whatsapp/services/auth.dart';
import 'package:whatsapp/services/database.dart';

class ChatRoom extends StatefulWidget {
  @override
  _ChatRoomState createState() => _ChatRoomState();
}

class _ChatRoomState extends State<ChatRoom> {

  AuthMethods authMethods = new AuthMethods();
  DatabaseMethods databaseMethods = new DatabaseMethods();
  Stream chatRoomStream;

  Widget chatRoomList(){
    return StreamBuilder(
      stream: chatRoomStream,
      builder: (context, snapshot) {
        return snapshot.hasData ? ListView.builder(
        itemCount: snapshot.data.documents.length,
        itemBuilder: (context, index) {
          return ChatRoomTile(
              snapshot.data.documents[index]["chatRoomId"],
          );
       }) : Container(color: Colors.red,);
      },
    );
  }

  @override
  void initState() {
   getUserInfo();
    super.initState();
  }

  getUserInfo() async{
    Constants.myName = await HelperFunctions.getUserNameSharedPreference();
    databaseMethods.getChatRooms(Constants.myName).then((val){
      setState(() {
        chatRoomStream = val;
      });
    });
    setState(() {

    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Color(0xff161517),
          title: Text(
            'WhatsApp',
            style: TextStyle(
              color: Colors.white54,
              fontSize: 20.0,
            ),
          ),
          actions: [
            Container(
              height: 25.0,
              width: 25.0,
              child: FloatingActionButton(
                heroTag: "btn1",
                backgroundColor: Color(0xff161517),
                child: Icon(Icons.search, color: Colors.white54,),
                onPressed: (){
                },
              ),
            ),
            GestureDetector(
              onTap: (){
                authMethods.signOut();
                Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Authenticate()));
              },
              child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 15.0),
                  child: Icon(
                    Icons.exit_to_app,
                    color: Colors.white54,
                  ),
              ),
            ),
            GestureDetector(
              onTap: (){
              },
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 1.0),
                child: Icon(
                  Icons.more_vert,
                  color: Colors.white54,
                ),
              ),
            ),
          ],
        ),
        body: chatRoomList(),
        floatingActionButton: FloatingActionButton(
          heroTag: "btn2",
          backgroundColor: Colors.green[700],
          onPressed: (){
            Navigator.push(context, MaterialPageRoute(builder: (context) => SearchScreen()));
          },
          child: Icon(
            Icons.message,
            color: Colors.white,
          ),
        ),
      ),
    );
  }
}

class ChatRoomTile extends StatelessWidget {

  final String userName;
  ChatRoomTile(this.userName);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        children: [
          Container(
            decoration: BoxDecoration(
              shape: BoxShape.circle,
               image: DecorationImage(
                  image: AssetImage("assets/images/DefaultPhoto.png"),
                  fit: BoxFit.fill,
               ),
              borderRadius: BorderRadius.circular(40.0),
            ),
          ),
          SizedBox(width: 8.0,),
          Text(
            userName,
            style: TextStyle(
              color: Colors.white,

            ),
          ),
        ],
      ),
    );
  }
}

如果有人想要任何小部件的详细信息,您可以问我。

2 个答案:

答案 0 :(得分:0)

您可以尝试将其添加到AndroidManifest.xml吗?

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

因为它使此错误从我的日志中消失了(但我不确定100%)。

答案 1 :(得分:-1)

当无线处于活动状态但与Firestore的连接失败时,我看到此错误。例如,在调试时我连接到本地仿真器,如果忘记启动仿真器,则会收到此消息,但该应用程序仍可从缓存中运行。