attachmentConfigurationMapFromConfigString function

Map<ApptiveGridEnvironment, AttachmentConfiguration?> attachmentConfigurationMapFromConfigString(
  1. String configString
)

Converts a configString to an actual map of ApptiveGridEnvironment and ApptiveGridConfiguration

More Info on how to get a configString will follow later

Implementation

Map<ApptiveGridEnvironment, AttachmentConfiguration?>
    attachmentConfigurationMapFromConfigString(String configString) {
  final json =
      jsonDecode(const Utf8Decoder().convert(base64Decode(configString)));

  final map = <ApptiveGridEnvironment, AttachmentConfiguration?>{};
  map[ApptiveGridEnvironment.alpha] = json['alpha'] != null
      ? AttachmentConfiguration.fromJson(json['alpha'])
      : null;
  map[ApptiveGridEnvironment.beta] = json['beta'] != null
      ? AttachmentConfiguration.fromJson(json['beta'])
      : null;
  map[ApptiveGridEnvironment.production] = json['production'] != null
      ? AttachmentConfiguration.fromJson(json['production'])
      : null;
  return map;
}