firstByType<T extends Widget> method
Element?
firstByType<T extends Widget>()
Returns the first mounted element whose widget type is T, or null.
Implementation
Element? firstByType<T extends Widget>() {
final matches = byType<T>();
return matches.isEmpty ? null : matches.first;
}