Skip to content

Commit fb13178

Browse files
authored
feat: add Dio timeouts (#219)
1 parent 7938b46 commit fb13178

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/core/common/config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:path_provider/path_provider.dart';
1212

1313
interface class Config {
1414
static const String environmentFolder = 'environments';
15+
static const Duration defaultTimeout = Duration(seconds: 30);
1516

1617
static const debugMode = kDebugMode;
1718
static bool testingMode = Platform.environment.containsKey('FLUTTER_TEST');

lib/core/source/common/http_service.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class HttpServiceDio implements HttpService {
5252
HttpServiceDio(List<Interceptor> interceptors) {
5353
final options = BaseOptions(
5454
baseUrl: Config.apiBaseUrl,
55+
connectTimeout: Config.defaultTimeout,
56+
sendTimeout: Config.defaultTimeout,
57+
receiveTimeout: Config.defaultTimeout,
5558
// TODO: Remove api key. It's only needed for Supabase
5659
headers: {'apikey': Config.supabaseApiKey},
5760
contentType: Headers.jsonContentType,

0 commit comments

Comments
 (0)