MBInactiveUserTrigger.fromDictionary constructor

MBInactiveUserTrigger.fromDictionary(
  1. Map<String, dynamic> dictionary
)

Initializes an inactive user trigger with the data of the dictionary returned by the APIs.

Implementation

factory MBInactiveUserTrigger.fromDictionary(
    Map<String, dynamic> dictionary) {
  String id = dictionary['id'] ?? '';
  int days = 0;
  if (dictionary['days'] is int) {
    days = dictionary['days'];
  } else if (dictionary['days'] is String) {
    days = int.tryParse(dictionary['days'] as String) ?? 0;
  }

  return MBInactiveUserTrigger(
    id: id,
    days: days,
  );
}