getBrands method
Implementation
Future<List<Brand>> getBrands(String token) async {
try {
final result = await dio.get<List<dynamic>>(
'${Config.url}/brands/user/all',
options: Options(
headers: {
'Authorization': 'Bearer $token',
},
),
);
if (result.data != null) {
return result.data!
.map((e) => Brand.fromJson(e as Map<String, dynamic>))
.toList();
}
} catch (e) {
return [];
}
return [];
}