Skip to content

Instantly share code, notes, and snippets.

View TimurMukhortov's full-sized avatar
🏄‍♀️
On code review

Timur Mukhortov TimurMukhortov

🏄‍♀️
On code review
View GitHub Profile
@TimurMukhortov
TimurMukhortov / authorization_interceptor.dart
Last active May 16, 2024 19:18
Dio authorization Interceptor with QueuedInterceptorsWrapper
class AuthorizationInterceptor extends QueuedInterceptorsWrapper {
final TokenRepository _tokenRepository;
final AuthorizationRepository _authorizationRepository;
final RefreshTokenRepository _refreshTokenRepository;
AuthorizationInterceptor({
required TokenRepository tokenRepository,
required AuthorizationRepository authorizationRepository,
required RefreshTokenRepository refreshTokenRepository,
}) : _tokenRepository = tokenRepository,
@TimurMukhortov
TimurMukhortov / preference_utils.dart
Last active February 24, 2021 17:45
PreferenceUtils
import 'package:shared_preferences/shared_preferences.dart';
class PreferenceUtils {
static Future<SharedPreferences> get _instance async =>
_prefsInstance ??= await SharedPreferences.getInstance();
static SharedPreferences _prefsInstance;
/// Call this method from iniState() function of mainApp() fo create instance [PreferenceUtils]
static Future<SharedPreferences> init() async {
_prefsInstance = await _instance;