first static method

OverlayCloser? Function(Iterable<OverlayCloser> closers) first({
  1. String? id,
})

A selector that returns the first overlay that matches the given id.

If id is null, it returns the first overlay.

Example:

context.close(Overlays.first(id: 'my-id'));

Implementation

static OverlayCloser? Function(Iterable<OverlayCloser> closers) first({
  String? id,
}) {
  return (Iterable<OverlayCloser> closers) {
    final filtered = id != null ? closers.byId(id) : closers;
    return filtered.isEmpty ? null : filtered.first;
  };
}