PushNotificationChannelConfig.fromEnv constructor

PushNotificationChannelConfig.fromEnv(
  1. String prefix,
  2. Map<String, String> env
)

Implementation

factory PushNotificationChannelConfig.fromEnv(
  String prefix,
  Map<String, String> env,
) {
  final interpreter = const EnvironmentInterpreter();

  return PushNotificationChannelConfig(
    channelKey: env['${prefix}_CHANNEL_KEY']!,
    channelName: env['${prefix}_CHANNEL_NAME']!,
    channelDescription: env['${prefix}_CHANNEL_DESCRIPTION']!,
    criticalAlerts: interpreter.isTrue(env['${prefix}_CRITICAL_ALERTS']),
    onlyAlertOnce: interpreter.isTrue(env['${prefix}_ONLY_ALERT_ONCE']),
    playSound: interpreter.isTrue(env['${prefix}_PLAY_SOUND']),
    enableVibration: interpreter.isTrue(env['${prefix}_ENABLE_VIBRATION']),
    locked: interpreter.isTrue(env['${prefix}_LOCKED']),
    importance: interpreter.mapImportanceToEnum(env['${prefix}_IMPORTANCE']),
  );
}