feat: update font family references and improve error handling in local storage
This commit is contained in:
@@ -7,11 +7,10 @@ class DioFormData implements IFormData {
|
||||
final FormData _formData = FormData();
|
||||
|
||||
@override
|
||||
void addFile(String field, Uint8List bytes, String filename) {
|
||||
_formData.files.add(MapEntry(
|
||||
field,
|
||||
MultipartFile.fromBytes(bytes, filename: filename),
|
||||
));
|
||||
Future<void> addFile(String field, Uint8List bytes, String filename) async {
|
||||
_formData.files.add(
|
||||
MapEntry(field, MultipartFile.fromBytes(bytes, filename: filename)),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -5,12 +5,28 @@ class DioRemote implements IHttpClient {
|
||||
String? baseUrl;
|
||||
late Dio dio;
|
||||
AppInterceptor? interceptors;
|
||||
Duration? connectTimeout;
|
||||
Duration? receiveTimeout;
|
||||
Duration? sendTimeout;
|
||||
|
||||
DioRemote({this.baseUrl, this.interceptors});
|
||||
DioRemote({
|
||||
this.baseUrl,
|
||||
this.interceptors,
|
||||
this.connectTimeout,
|
||||
this.receiveTimeout,
|
||||
this.sendTimeout,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
dio = Dio(BaseOptions(baseUrl: baseUrl ?? ''));
|
||||
dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: baseUrl ?? '',
|
||||
connectTimeout: connectTimeout ?? const Duration(seconds: 30),
|
||||
receiveTimeout: receiveTimeout ?? const Duration(seconds: 30),
|
||||
sendTimeout: sendTimeout ?? const Duration(seconds: 30),
|
||||
),
|
||||
);
|
||||
if (interceptors != null) {
|
||||
interceptors!.dio = dio;
|
||||
dio.interceptors.add(interceptors!);
|
||||
@@ -84,7 +100,9 @@ class DioRemote implements IHttpClient {
|
||||
|
||||
if (fromJson != null) {
|
||||
final rawData = response.data;
|
||||
final parsedData = rawData is Map<String, dynamic> ? fromJson(rawData) : null;
|
||||
final parsedData = rawData is Map<String, dynamic>
|
||||
? fromJson(rawData)
|
||||
: null;
|
||||
response.data = parsedData;
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
@@ -136,7 +154,9 @@ class DioRemote implements IHttpClient {
|
||||
);
|
||||
if (fromJson != null) {
|
||||
final rawData = response.data;
|
||||
final parsedData = rawData is Map<String, dynamic> ? fromJson(rawData) : null;
|
||||
final parsedData = rawData is Map<String, dynamic>
|
||||
? fromJson(rawData)
|
||||
: null;
|
||||
response.data = parsedData;
|
||||
return DioResponse<T>(response);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
abstract class IFormData{
|
||||
void addFile(String field, Uint8List bytes, String filename);
|
||||
Future<void> addFile(String field, Uint8List bytes, String filename);
|
||||
void addField(String key, String value);
|
||||
}
|
||||
Reference in New Issue
Block a user