dvStudioGraphRoutes function
The routes the project graph in root lists, or none when there is no
graph to read.
Implementation
List<Map<String, Object?>> dvStudioGraphRoutes(String? root) {
if (root == null) return const <Map<String, Object?>>[];
final File graph = File('$root${Platform.pathSeparator}graph.json');
try {
final Object? decoded = jsonDecode(graph.readAsStringSync());
final Object? routes = decoded is Map ? decoded['routes'] : null;
return <Map<String, Object?>>[
if (routes is List)
for (final Object? route in routes)
if (route is Map && route['path'] is String)
route.cast<String, Object?>(),
];
} on Object {
return const <Map<String, Object?>>[];
}
}