resolveLiveAppCommand function

String? resolveLiveAppCommand(
  1. String name,
  2. List<LiveManifestEntry> entries
)

The full name of the project live command name refers to: an exact category:name, or a bare name that only one command in entries has.

Names with a category are returned as they are, since the app may have commands commands.json doesn't list.

Implementation

String? resolveLiveAppCommand(String name, List<LiveManifestEntry> entries) {
  if (name.contains(':')) return name;
  final List<LiveManifestEntry> matches = entries
      .where((entry) => entry.name == name)
      .toList();
  return matches.length == 1 ? matches.single.fullName : null;
}