handleEvent method

  1. @override
ModelChangedEvent? handleEvent(
  1. String name,
  2. dynamic data
)
override

Implementation

@override
ModelChangedEvent? handleEvent(String name, dynamic data) {
  if (name == 'change') {
    if (data is! Map<String, dynamic>) {
      throw InvalidMessageException(
          'tried to update the model $rid with ${data.runtimeType}', data);
    }
    final values = data['values'];
    if (values is! Map<String, dynamic>) {
      throw InvalidMessageException(
          'tried to update the model $rid with ${values.runtimeType}',
          values);
    }
    _client.cacheResources(data);
    final updates = _updateData(values, reset: false);
    if (updates != null) {
      return ModelChangedEvent(rid, updates.item1, updates.item2);
    }
  }
  return null;
}