小编Sag*_*nde的帖子

Flutter SocketException (SocketException: OS Error: Connection denied, errno = 111, address = localhost, port = 51500)

我使用的是 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)

}

知道如何解决这个问题

关于Socket异常的问题

更新:

找到解决方案:如果您在本地运行服务器并使用 Android 模拟器,那么您的服务器端点应该是 10.0.2.2:8000 而不是 localhost:8000,因为 AVD 使用 10.0.2.2 …

mangodb flutter strapi

8
推荐指数
3
解决办法
2万
查看次数

如何借助 flutter 应用程序内购买去除广告

我想在用户购买“通过应用内购买帮助删除广告”包后禁用 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)

in-app-purchase admob flutter

5
推荐指数
1
解决办法
1816
查看次数

标签 统计

flutter ×2

admob ×1

in-app-purchase ×1

mangodb ×1

strapi ×1