Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0 error flutter

I am getting this warning in my run console. Baically, my chatRoomTile is not been showed on the screen. It just shows blank screen, even after i have had chat with 10 persons.

It is just showing the main screen, and the red container for 2 seconds, as in conditional statement.

This is the output in run -

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.

Here is my code -

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,

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

If anyone wants details for any widget, you can ask me.

like image 224
Shreyansh Sharma Avatar asked Oct 13 '20 21:10

Shreyansh Sharma


4 Answers

Add the following permission to android/app/src/main/AndroidManifest.xml, before <application> starts:

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
like image 120
Mr. FORTAS Avatar answered Sep 25 '22 21:09

Mr. FORTAS


I had the same error. I looked through my code and found that I had given the wrong collection name while I was calling firebasefirestore. Please do check that you are providing the right reference names to collections and docs.

like image 20
Razak Avatar answered Sep 27 '22 21:09

Razak


I see this error when wireless is active but the connection to Firestore fails. For example, when debugging I connect to the local emulators, if I forget to start the emulator I get this message, but the app still works from cache.

like image 44
shbinga Avatar answered Sep 25 '22 21:09

shbinga


Why it comes?

It's because your emulator doesn't have internet connection. Though it is showing wifi connection.

Solution:

  1. first of all check your internet connection status.
  2. Go to Emulator and turn off wifi and then again turn on wifi. That's it.

Also, don't forget to add the below code to the AndroidManifest.xml

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

before <android>

like image 1
Azizur Rahaman Avatar answered Sep 27 '22 21:09

Azizur Rahaman