我使用的是 Strapi.io 开源 Node.js Headless CMS
这是我的注册页面代码
void _registerUser() 异步 {
http.Response response =
await http.post('http://localhost:1337/auth/local/register', body: {
"username": _userName,
"email": _email,
"password": _password,
});
final responseData = json.decode(response.body);
if (response.statusCode == 200) {
// If the call to the server was successful, parse the JSON
return print(responseData);
} else {
// If that call was not successful, throw an error.
throw Exception('Failed to load post');
}
Run Code Online (Sandbox Code Playgroud)
}
知道如何解决这个问题
更新:
找到解决方案:如果您在本地运行服务器并使用 Android 模拟器,那么您的服务器端点应该是 10.0.2.2:8000 而不是 localhost:8000,因为 AVD 使用 10.0.2.2 …
我想在用户购买“通过应用内购买帮助删除广告”包后禁用 Admob 广告。我想删除插页式广告和奖励广告,下面是插页式广告和奖励广告的代码:
InterstitialAd myInterstitial = InterstitialAd(
adUnitId: Platform.isIOS ? ios_ads : android_ads,
listener: (MobileAdEvent event) {
print("InterstitialAd event is $event");
},
);
myInterstitial
..load()
..show(
anchorType: AnchorType.bottom,
anchorOffset: 0.0,
);
Run Code Online (Sandbox Code Playgroud)
奖励广告
RewardedVideoAd.instance.listener =
(RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
if (event == RewardedVideoAdEvent.rewarded) {
}
};
RewardedVideoAd.instance.load(adUnitId: Platform.isIOS ? ios_ads : android_ads,
targetingInfo: targetingInfo).then((v){
print("log "+v.toString());
if(v){
RewardedVideoAd.instance.show();
}
});
Run Code Online (Sandbox Code Playgroud)