skip to Main Content

Future API Call Flutter

Im trying to create an simple Network class on dart, to centralize all my calls to an specific API. So i create an Service class, and create an mock and a get function using Dio. import 'package:dio/dio.dart'; import 'package:flutter/services.dart'; import…

VIEW QUESTION

Flutter – On parsing JSON in Dart getting type '_Map<String, dynamic>' is not a subtype of type 'String' error

So I have open api json response of model: { "object": "list", "data": [ { "id": "whisper-1", "object": "model", "created": 1677532384, "owned_by": "openai-internal", "permission": [ { "id": "modelperm-KlsZlfft3Gma8pI6A8rTnyjs", "object": "model_permission", "created": 1683912666, "allow_create_engine": false, "allow_sampling": true, "allow_logprobs": true, "allow_search_indices": false,…

VIEW QUESTION

Can Flutter Dio re-call POST with file upload after token refresh in Interceptor’s onError?

So, I have an interceptor set for api calls. It looks like this: class AuthorizationInterceptor extends Interceptor { @override void onRequest( RequestOptions options, RequestInterceptorHandler handler) async { if (options.headers.containsKey('requiresToken') && options.headers['requiresToken'] == false) { options.headers.remove('requiresToken'); super.onRequest(options, handler); } else {…

VIEW QUESTION
Back To Top
Search