toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() => {
  'path': path,
  'name': ?name,
  'description': ?description,
  'flavor': ?flavor,
  // As written, shorthands and all — same rule as `platforms` below.
  if (flavorByPlatform.isNotEmpty)
    'flavorByPlatform': {
      for (var entry in flavorByPlatform.entries) entry.key.name: entry.value,
    },
  // As written, shorthands and all. The tool expands them where it matches
  // devices; the manifest keeps the author's word so a picker can say
  // `desktop` rather than reciting three platforms back at them.
  if (platforms.isNotEmpty) 'platforms': [for (var p in platforms) p.name],
  if (knobs.isNotEmpty) 'knobs': [for (var k in knobs) k.toJson()],
};