init method
POST method for Cloud function call
Pass UserModel
as user
required for authentication based on app token
Implementation
// Future<Map<String, dynamic>> post(
// {required String endpoint, required Map<String, dynamic> body,}) async {
// try {
// dio.Response rawResponse =
// await _dio.post(baseUrl + endpoint, data: body,);
// return rawResponse.data;
// } on dio.DioException catch (e) {
// log(e.response.toString());
// throw ApiError.fromResponse(e.response!);
// }
// }
void init(String apikey, String userId) {
_apiKey = apikey;
_userId = userId;
String check = apikey.split("_")[0];
if (check == "prod") {
apiBaseUrl = prodURL;
} else if (check == "dev") {
apiBaseUrl = devURL;
} else {
throw "Invalid API Key";
}
}