title: mocking Dio is not working to test my app in Flutter
body: <p>I am trying to write unit tests for my request with Dio but I keep getting this error:
  <strong>type 'Null' is not a subtype of type 'BaseOptions'</strong></p>
  <p>I tried adding the base options on DioMock in a lot of different ways but the test remains the same.
  How can I fix it?</p>
  <p>Bellow are my Network class and the test class.</p>
  <pre><code>class NetworkService {
  
    final Dio dio;
  
    NetworkService(this.dio){
      dio.options.baseUrl = &quot;https://food2fork.ca/api/recipe/search&quot;;
      dio.options.headers['Authorization'] = 'Token 9c8b06d329136da358c2d00e76946b0111ce2c48';
  
      dio.interceptors.add(InterceptorsWrapper(
        onRequest: (options, handler){
          print('base ${options.baseUrl}');
          print(&quot;PATH: ${options.path}&quot;);
          return handler.next(options);
        },
        onResponse: (response, handler){
          print(&quot;RESPONSE: ${response.statusCode}  PATH: ${response.requestOptions.path}&quot;);
      return handler.next(response);
      },
        onError: (DioError e, handler){
          print(&quot;ERROR: ${e.response?.statusCode} =&gt; PATH: ${e.requestOptions.path}&quot;);
          return handler.next(e);
        }
      ));
    }
  
    Future&lt;List&lt;Recipe&gt;&gt; getRecipe() async {
      var response = await dio.get('/?page=1&amp;query=beef');
      print(&quot;response ${response.data}&quot;);
      if(response.statusCode == 200){
        final List&lt;Recipe&gt; recipeList = [];
        for(Map&lt;String, dynamic&gt; recipe in response.data['results']){
          recipeList.add(Recipe.fromJson(recipe));
        }
        return recipeList;
      } else {
        throw Exception('sss');
      }
  
    // ONBOARDING
    }
  }
  </code></pre>
  <pre><code>class DioMock extends Mock implements DioForNative {}
  
  class RecipeMock extends Mock implements Recipe {}
  
  main() {
  
    final dio = DioMock();
  
    final service = NetworkService(dio);
  
    dio.options.baseUrl = &quot;https://food2fork.ca/api/recipe/search&quot;;
    dio.options.headers =  { 'Content-type': 'application/json', 'Accept': 'application/json' };
  
    test(&quot;should return Onboarding Model&quot;, () async {
      final response = Response(
          requestOptions: RequestOptions(
              path: 'gfh',
            baseUrl: &quot;fgh&quot;
          ),
          data: RecipeMock()
  
      );
      when(dio.get(
          &quot;https://food2fork.ca/api/recipe/search&quot;))
          .thenAnswer((_) async =&gt; response);
  
      final result = await service.getRecipe();
      expect(result, isA&lt;Recipe&gt;());
  
    });
  }
  </code></pre>