Last active
July 30, 2021 09:24
-
-
Save shiburagi/2758c20c12b56e3d349885b0f13aca76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:developer'; | |
import 'package:dio/dio.dart'; | |
import 'package:flutter_network_call_with_auth/interceptor/app.dart'; | |
class AppRepo { | |
AppRepo._(); | |
static final AppRepo instance = AppRepo._(); | |
final Dio _dio = Dio() | |
..options = BaseOptions(baseUrl: "https://reqres.in/api/") | |
..interceptors.addAll([ | |
AppInteceptor(), // include AppInterceptor here | |
LogInterceptor( | |
logPrint: (object) => log("$object", name: "Dio"), | |
) | |
]); | |
Future getUser() => _dio.get("users/2"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment