All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dart.libraries.dio.auth.auth.mustache Maven / Gradle / Ivy

There is a newer version: 7.6.0
Show newest version
{{>header}}
import 'package:dio/dio.dart';

abstract class AuthInterceptor extends Interceptor {
  /// Get auth information on given route for the given type.
  /// Can return an empty list if type is not present on auth data or
  /// if route doesn't need authentication.
  List> getAuthInfo(RequestOptions route, bool Function(Map secure) handles) {
    if (route.extra.containsKey('secure')) {
      final auth = route.extra['secure'] as List>;
      return auth.where((secure) => handles(secure)).toList();
    }
    return [];
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy