Skip to content

Commit

Permalink
fix: change dio service null values
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Nov 20, 2023
1 parent 39153b3 commit 057bd48
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/data/services/dio_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class DioRestService<V> {
_dio = initDio;
}

Future<Either<V, T>> get<T>(
Future<Either<V, T?>> get<T>(
Uri uri, {
Map<String, dynamic>? headers,
}) async {
return _tryCatch(
() async {
final response = await _dio.getUri<T>(
final response = await _dio.getUri<T?>(
uri,
options: Options(headers: headers),
);
Expand All @@ -90,14 +90,14 @@ class DioRestService<V> {
);
}

Future<Either<V, T>> post<T>(
Future<Either<V, T?>> post<T>(
Uri uri, {
Object? data,
Map<String, dynamic>? headers,
}) async {
return _tryCatch(
() async {
final response = await _dio.postUri<T>(
final response = await _dio.postUri<T?>(
uri,
data: data,
options: Options(headers: headers),
Expand All @@ -107,7 +107,7 @@ class DioRestService<V> {
);
}

Future<Either<V, T>> _tryCatch<T>(Future<T> Function() function) async {
Future<Either<V, T?>> _tryCatch<T>(Future<T?> Function() function) async {
try {
final result = await function();
return Right(result);
Expand Down

0 comments on commit 057bd48

Please sign in to comment.