addNotifications<T> method

void addNotifications<T>(
  1. T r
)

Implementation

void addNotifications<T>(T r) {
  if (r is ValidationNotification) {
    _notifications.add(r);
  } else if (r is List<ValidationNotification>) {
    _notifications.addAll(r);
  } else if (r is ValidationNotifiable) {
    for (final f in r.notifications) {
      ValidationNotification tempNotification =
          ValidationNotification(property: f.property, message: f.message);
      _notifications.add(tempNotification);
    }
  } else if (r is List) {
    if (r.length > 1 && r[0] is String && r[1] is String) {
      _notifications.add(
        ValidationNotification(
            property: r[0] as String, message: r[1] as String),
      );
    }
  }
}