Skip to content

Instantly share code, notes, and snippets.

@shiburagi
Last active July 30, 2021 09:24
Show Gist options
  • Save shiburagi/2758c20c12b56e3d349885b0f13aca76 to your computer and use it in GitHub Desktop.
Save shiburagi/2758c20c12b56e3d349885b0f13aca76 to your computer and use it in GitHub Desktop.
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