addPackage static method
it will add package to pubspec.yaml
with latest version
and run pub get command.
addPackage(Packages.dio)
Implementation
static Future<void> addPackage(
Packages package, [
bool openDocumentation = false,
]) async {
if (openDocumentation) {
try {
Shell().run('start https://pub.dev/packages/${_enumToString(package)}');
} catch (e) {
print(e.toString());
}
}
try {
await Shell().run('flutter pub add ${_enumToString(package)}');
} catch (e) {
print(e.toString());
}
}