Not able to import the intl package for dart

Faced the same issue, if you are importing

import "package:intl/intl_browser.dart";

then you will get that error, it seems like the dart SDK bundled with flutter does not have the required dependencies.

So use only

import 'package:intl/intl.dart';

and it should work just fine.


Here are some steps that I offten see as problems with dependencies in flutter.

  1. The thing with pubspec.yaml is that you have to save it CRTL/CMD + S before pub get will work. Running pub get from IDE doesn't save the file automatically.

  2. Try running flutter clean and then run flutter pub get. Sometimes when you remove dependencies like plugins, .build folder doesnt get cleaned up properly so you have to do it manually.

  3. You can try to repair pub cache by running flutter pub cache repair

  4. Sometimes just restarting your IDE might solve the problem as well.

Tags:

Dart

Flutter