makePostRequest method

TaskEither<String, Response<Map<String, dynamic>>> makePostRequest(
  1. String path,
  2. Map<String, dynamic> data
)

Implementation

TaskEither<String, Response<Map<String, dynamic>>> makePostRequest(
  String path,
  Map<String, dynamic> data,
) =>
    TaskEither<String, Response<Map<String, dynamic>>>.tryCatch(
      () async => dio.post(
        path,
        data: jsonEncode(data),
        options: Options(
          headers: <String, dynamic>{
            HttpHeaders.contentTypeHeader: "application/json",
          },
        ),
      ),
      (Object error, StackTrace stackTrace) => error.toString(),
    );