'I have a problem with Flutter in the dio library (dio: ^4.0.0)

DioHelper Class:

DioHelper Class

Dependecies:

dependencies

import 'package:dio/dio.dart';

class DioHelper {
  static late Dio dio;

  static void initDio() {
    dio = Dio(
      BaseOptions(
        baseUrl: 'https://newsapi.org/',
        receiveDataWhenStatusError: true,
      ),
    );
  }
}


Solution 1:[1]

I had the same issue. Simply restart your editor and it should be fixed :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Charles Van Damme