firstByKey method

Element? firstByKey(
  1. Key key
)

Returns the first mounted element whose widget key equals key, or null.

Implementation

Element? firstByKey(Key key) {
  final matches = byKey(key);
  return matches.isEmpty ? null : matches.first;
}