title: Not Firing Interceptors in Flutter
body: <p>Flutter Custom Interceptors code here, it is showing error on onRequest Method as well as onResponse Method and onError Method. recently started flutter implementation.</p>
  <pre><code> class AppInterceptors extends Interceptor {
        Dio _dio = Dio();
        SharedPreferences _prefs;
        TokenAnalyzer _tokenAnalyzer;
      
        AppInterceptors(this._dio, this._tokenAnalyzer);
        @override
        Future&lt;dynamic&gt; onRequest(RequestOptions options) async {
          _prefs = await _sharedPreferences;
          var accessToken = _prefs.get(&quot;access_token&quot;) ?? '';
      
          return options;
        }
      
        @override
        Future&lt;dynamic&gt; onResponse(Response options) async {
          return options;
        }
      
        @override
        Future&lt;dynamic&gt; onError(DioError dioError) async {
         
      
          if (dioError.type == DioErrorType.response &amp;&amp;
                  dioError.response.statusCode &lt; 200 ||
              dioError.response.statusCode &gt; 400) {
            if (dioError.response.statusCode == 500) {
              prefs.setString(&quot;ErrorMessage&quot;, dioError.response.data);
              errorService.showErrorMessage(dioError.response.data);
              throw (dioError.response.data);
            } else if (dioError.response.statusCode == 401) {
              var _prefs = await _sharedPreferences;
              prefs.setString(&quot;ErrorMessage&quot;, dioError.response.data);
           
            }
          }
          return null;
        }
  </code></pre>
  <p>Here it is another file implemented DIO instillation</p>
  <pre><code>class DioHttpClient {
    Dio _dio = Dio();
    BaseOptions options = new BaseOptions(
        receiveTimeout: 1000 * 60,
        headers: {'Content-Type': 'application/json', 'Authorization': ''});
  
    DioHttpClient(TokenAnalyzer tokenAnalyzer) {
      _dio = new Dio(options);
      _dio.interceptors.add(AppInterceptors(_dio, tokenAnalyzer));
    }
  
    Dio get HttpClient {
      return _dio;
    }
  }
  </code></pre>
  <p>API Call Code below:</p>
  <pre><code> Dio _httpClient1 = Dio();
   
    Future&lt;T&gt; post&lt;T&gt;(url, body, {allowAnnoymous = false}) async {
     
      SharedPreferences prefs = await SharedPreferences.getInstance();
      try {
        print(&quot;called new post method $url&quot;);
        clientService.isBusy = true;
        String token = prefs.get(&quot;AccessToken&quot;);
        Response response = await _httpClient1.post&lt;T&gt;(url,
            data: jsonEncode(body),
            options: Options(headers: {
              &quot;allowanonymous&quot;: allowAnnoymous.toString(),
              'Authorization': 'Bearer $token',
            }));
        print(&quot;====================   success post&quot;);
        throwError(response);
        return response.data;
      } catch (ex) {
        throwErrorMessage();
        throw ex;
      }
    }
  </code></pre>
  <p>I am getting below error and it is showing error Like this</p>
  <pre><code>'AppInterceptors.onRequest' ('Future&lt;dynamic&gt; Function(RequestOptions)') isn't a valid override of 'Interceptor.onRequest' ('void Function(RequestOptions, RequestInterceptorHandler)').
  </code></pre>
  <p>Could you please help me anyone !! thanks Advance !!!</p>