In debug mode, everything looks good, get answers and data lists from my API. But after creating app-release.apk and installing it on my phone, there is no more internet connection
Here is my code :
ScopedModelDescendant<ReportPosViewModel>(
builder: (context, child, model) {
return FutureBuilder<List<Invoice>>(
future: model.invoices,
builder: (_,
AsyncSnapshot<List<Invoice>> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.active:
case ConnectionState.waiting:
return Center(
child:
const CircularProgressIndicator());
case ConnectionState.done:
if (snapshot.hasData) {
//something todo
} else if (snapshot.hasError) {
return NoInternetConnection(
action: () async {
await model.setInvoice();
await getData();
},
);
}
}
},
);
},
),
In debug mode, it is not needed.
In the AndroidManifest.xml
file located at android/app/src/main
you need to add this permission inside the manifest
tag.
<uses-permission android:name="android.permission.INTERNET"/>