在调试模式下,一切正常。我从 API 得到答案和数据列表。但是在创建了 App-release. apk并将其安装到我的手机上之后,就再也没有互联网连接了。
这是我的代码:
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();
},
);
}
}
},
);
},
),