initIOESdk method

Implementation

@override
Future<BaseCallBack<AppException, InitSdkResponseModel>> initIOESdk(InitSdkRequestModel request) async {
  final callback = await initService.post(AppApi.init, data: request.toJson());
  return callback.execute((exception) => BaseCallBack.error(exception), (response) {
    try {
      final initResponse = InitSdkResponseModel.fromJson(response.data);
      if (initResponse.data == null) {
        return BaseCallBack.error(AppException(
            message: initResponse.msg.toString(),
            statusCode: initResponse.code ?? AppApi.unknownErrorCode,
            identifier: response.statusMessage.toString()));
      }
      return BaseCallBack.success(initResponse);
    } catch (e) {
      return BaseCallBack.error(AppException(
          message: response.statusMessage.toString(),
          statusCode: response.statusCode,
          identifier: response.statusMessage.toString()));
    }
  });
}