- Introduction
- Basics
- App1 : Elon Musk’s Resume
- App2 : 5K Quotes
- App3 : Calculator
- App4_v1 : Flags Quiz
- Running Apps On Different Devices
- Debbuging
- App5 : Yacht Charter
- App6_v1 : My Books
- Creating responsive and adaptive apps
- App6_v2: My Books
- App7 : Short Vacation
- App8 : Movie Time
- App9 : Schedule Planner
- Shared Preferences
- App10 : Local Weather
- App11 : Discover Tunisia
Using Packages
Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch.
Packages : At a minimum, a Dart package is a directory containing a pubspec file. Additionally, a package can contain dependencies (listed in the pubspec), Dart libraries, apps, resources, tests, images, and examples. The pub.dev site lists many packages—developed by Google engineers and generous members of the Flutter and Dart community— that you can use in your app.
- Searching for packages
- Adding a package dependency to an app
- Depend on it
- Install it
- Import it
- Stop and restart the app, if necessary
Packages are published to pub.dev.
The Flutter landing page on pub.dev displays top packages that are compatible with Flutter (those that
declare dependencies generally compatible with Flutter), and supports searching among all published
packages.
for example this package, shared_preferences
You can follow the steps in the Installing part.
Open the pubspec.yaml file located inside the app folder, and add shared_preferences: under dependencies.
From the terminal: Run flutter pub get.
ORFrom VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec.yaml.
Add a corresponding import statement in the Dart code.
For More Details : Flutter Docs