Not able to import the intl package for dart


Asked by nick.tdr on May 18, 2018 (source).

Hi I am trying to use the intl package in my flutter project. The packages get command runs successfully but when I import the package it shows error.

My pubspec.yaml file

For the import in the my dart file I am using the following import

import 'package:intl/intl.dart';

I have also upgraded flutter from the terminal using the flutter upgrade command.


Question answered by Tree (source).

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.