Converts Config to a JSON map.
Map<String, dynamic> toJson() { return { 'preferredRoots': preferredRoots, 'defaultTargets': defaultTargets, if (profile != null) 'profile': profile, }; }