postLocalInfoForRemoteDecision static method

Future<ForceUpdateRemoteDecision> postLocalInfoForRemoteDecision(
  1. String url
)

Implementation

static Future<ForceUpdateRemoteDecision> postLocalInfoForRemoteDecision(
    String url) async {
  PackageInfo packageInfo = await PackageInfo.fromPlatform();
  ForceUpdateLocalData localData = ForceUpdateLocalData(
      platform: Platform.isAndroid ? "android" : "ios",
      appName: "romoni-user",
      versionCode: packageInfo.buildNumber,
  );
  http.Response response = await http.post(Uri.parse(url),
      headers: {"Content-Type": "application/json"},
      body: jsonEncode(localData.toJson()));
  if (response.statusCode == 200) {
    return ForceUpdateRemoteDecision.fromJson(jsonDecode(response.body));
  }
  return ForceUpdateRemoteDecision();
}