flutter_dependency_doctor 0.1.3
flutter_dependency_doctor: ^0.1.3 copied to clipboard
An intelligent dependency health and optimization tool for Dart and Flutter projects.
import 'dart:io';
/// Example: Using Flutter Dependency Doctor programmatically.
///
/// Flutter Dependency Doctor is primarily a command-line tool ā it does not
/// currently expose a public Dart library API. This example shows how to
/// invoke the CLI from within a Dart script and handle its output/exit code,
/// which is useful if you want to run it as part of a custom build script,
/// CI pipeline, or automation tool.
Future<void> main(List<String> args) async {
final projectPath = args.isNotEmpty ? args[0] : Directory.current.path;
print('𩺠Running Flutter Dependency Doctor on: $projectPath\n');
final result = await Process.run(
'dart',
['run', 'flutter_dependency_doctor'],
workingDirectory: projectPath,
runInShell: true,
);
if (result.stdout.toString().isNotEmpty) {
stdout.write(result.stdout);
}
if (result.stderr.toString().isNotEmpty) {
stderr.write(result.stderr);
}
switch (result.exitCode) {
case 0:
print('\nā
Dependency check complete ā no critical issues found.');
break;
default:
print('\nā ļø Dependency Doctor exited with code ${result.exitCode}.');
print('Review the output above for details.');
}
exit(result.exitCode);
}