I’m a newbie trying to build my first Flutter app whilst using MongoDB Atlas as a database, however when I try the following code:
final db = await Db.create('mongodb+srv://admin:***@cluster0.z286eob.mongodb.net/****?retryWrites=true&w=majority');
print("AHH");
await db.open();
The AHH
never gets printed, ever. The ***
in the URL represents my user password and database name, and they’re correct because
It works when I try it on a real device, but not on the Android emulator with Android Studio.
Can someone help me solve this?
2
Answers
It happened to be some sort of bug with the emulator. When I tried it in a new one, it worked just fine.
You need to have Internet permission in AndroidManifest file.
The manifest file will be here :
projectdirectory/android/app/src/main