confirmServer method

Future<void> confirmServer()

Implementation

Future<void> confirmServer() async {

  var apisSingleton = ApisModel();

  var api = ApiLayer(env: apisSingleton.dataRequest);
  var response = await api.callApi(endpointData: apisSingleton.callServer);
  final result = serverModelFromMap(response.response);

  try {
    if(!result.versionEnable || !result.payment) {
      throw FlutterError(result.message);
    }
  } catch (e) {
    // ignore: avoid_print
    print("Megamil SDK $e");
    SystemNavigator.pop(animated: true);
  }

  apisSingleton.dataRequest["URL_BASE"] = result.server;
  apisSingleton.callIA.allowedSHAFingerprints = [result.sha];


}