readPackageJson function
The JSON object of a package.json, or an empty map when it does not
parse.
Implementation
Map<String, dynamic> readPackageJson(File file) {
try {
final json = jsonDecode(file.readAsStringSync());
return json is Map<String, dynamic> ? json : const {};
} catch (_) {
return const {};
}
}