I am new in Flutter. When I import the library: import 'package:intl/intl.dart';
, it says that the target of URI doesn't exist:package:intl/intl.dart;
Setting up Flutter Intl. Open Android Studio's preferences by pressing Command-, (comma) on macOS or Control-Alt-S on Linux or Windows. Select Plugins on the left-side panel (1) and Marketplace in the upper tab bar (2). Type intl in the search bar (3), then click Install for Localizely's Flutter Intl result (4).
The Intl class provides a common entry point for internationalization related tasks. An Intl instance can be created for a particular locale and used to create a date format via anIntl. date() . Static methods on this class are also used in message formatting.
When you import any package, example:
import 'package:intl/intl.dart';
You need to also add the package inside the pubspec.yaml
file under the dependencies
field example:
dependencies:
intl: ^0.15.7
Then from the terminal you can execute the following command:
flutter packages get
or
From Android Studio/IntelliJ:
Click Packages Get
in the action ribbon at the top of pubspec.yaml
more info here:
https://flutter.io/using-packages/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With