Add multiple packages in single command in flutter
Asked Answered
B

1

10

Suppose I have a list of packages which I want to add in my flutter project. I can do the job by simply adding those packages in pubspec.yaml file and then in command line write this command flutter pub get and get all those packages in my app. But If I want to do the same thing by command line how to do that? Like to add a single package what we do is flutter pub add xxx. What if I want to add multiple packages at the same time in project with a single command line. I have searched but did not get any clue.

Bomarc answered 1/11, 2021 at 18:35 Comment(1)
You can use && to combine multiple single commands like: flutter pub add xxx && flutter pub add yyy && flutter pub add zzz tell me if it's a valid solution for youSsw
L
11

Actually you can already do this using flutter pub add

For example i want to add dependecies for a project that use drift and riverpod, just run these two command instead of running separate pub add for each package.

# app dependencies
flutter pub add drift sqlite3_flutter_libs path_provider path flutter_riverpod

# dev dependencies
flutter pub add --dev drift_dev build_runner
Laryssa answered 14/7, 2022 at 9:12 Comment(1)
this is the answer for the above question, it should my marked as the answer.Brach

© 2022 - 2025 — McMap. All rights reserved.