firstForPropertyName method Null safety

EmpireStateChanged<T>? firstForPropertyName(
  1. String propertyName
)

Gets the first event where the EmpireStateChanged.propertyName matches the propertyName argument

Returns null if no event is found

Implementation

EmpireStateChanged<T>? firstForPropertyName(String propertyName) {
  final events = where((e) => e.propertyName == propertyName);

  return events.isNotEmpty ? events.first : null;
}