Flutter 颤振:释放apk不';t从api加载数据
我使用的是release apk,工作正常,在清单中添加了此权限Flutter 颤振:释放apk不';t从api加载数据,flutter,dart,apk,release,Flutter,Dart,Apk,Release,我使用的是release apk,工作正常,在清单中添加了此权限 <manifest xmlns:android="..."> <uses-permission android:name="android.permission.INTERNET"/> <!-- Add this --> </manifast> 这是我的api调用的一个示例 Future<Branches> getBra
<manifest xmlns:android="...">
<uses-permission android:name="android.permission.INTERNET"/> <!-- Add this -->
</manifast>
这是我的api调用的一个示例
Future<Branches> getBranches() async {
// Reusable.showLoading(context);
http.Response response = await http.get(
Uri.parse(baseUrl + "branches"),
);
//Reusable.dismissLoading();
return new Branches.fromJson(json.decode(response.body));
}
class Branches {
List<Datum> data;
Branches({this.data});
Branches.fromJson(Map<String, dynamic> json) {
if (json['posts'] != null) {
// ignore: deprecated_member_use
data = new List<Datum>();
json['posts'].forEach((v) {
data.add(new Datum.fromJson(v));
});
}
}
}
class Datum {
String id;
String name;
String img;
Datum({this.id, this.name, this.img});
Datum.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
img = json['img'];
}
Future getbranchs()异步{
//可重用。显示加载(上下文);
http.Response-Response=等待http.get(
parse(baseUrl+“分支”),
);
//可重用。dismissLoading();
返回新的branchs.fromJson(json.decode(response.body));
}
班支部{
列出数据;
分支({this.data});
fromJson(映射json){
if(json['posts']!=null){
//忽略:不推荐的\u成员\u使用
数据=新列表();
json['posts'].forEach((v){
data.add(新的Datum.fromJson(v));
});
}
}
}
类基准{
字符串id;
字符串名;
字符串img;
数据({this.id,this.name,this.img});
fromJson(映射json){
id=json['id'];
name=json['name'];
img=json['img'];
}
并且url支持https
但现在,突然间,令人费解的是,它不再起作用了
有什么可以导致这种情况!!!您好。问题不完整。添加更多详细信息。您如何调用您的api?发布更多代码示例;问题不在api中,api在发布模式下工作,但现在没有原因或错误请您提供api url?这主要是由于
clearTextTraffic
造成的。您的pi支持https
?是的,它支持:在这种情况下,请尝试放置print
,并处理错误情况。这可能解释了一些问题。