Skip to content

Instantly share code, notes, and snippets.

@freitzzz
Created January 9, 2021 17:46
Show Gist options
  • Save freitzzz/18184bd94258e748e8d1565cb6d08176 to your computer and use it in GitHub Desktop.
Save freitzzz/18184bd94258e748e8d1565cb6d08176 to your computer and use it in GitHub Desktop.
[one-liner] Flutter get packages in all packages of a project
File('.').listSync(recursive: true).whereType<File>().where((f) => f.path.endsWith('pubspec.yaml')).where((f) => !f.path.contains('ios/.symlinks')).map((f) => f.parent).map((d) => Process.runSync('flutter', ['pub', 'get'], workingDirectory: d.absolute.path)).forEach((x) => print(x.stdout));
@freitzzz
Copy link
Author

where((f) => !f.path.contains('ios/.symlinks'))

This is required as on iOS build, a .symlinks folder is created, pointing to packages used on the project

Process.runSync('flutter', ['pub', 'get'], workingDirectory: d.absolute.path)

Usage of runSync is required as Flutter command is not multithreaded (blocks upon usage)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment