maybeOf static method

Retrieves the FlutterFolderViewTheme from the closest FolderViewTheme ancestor without registering a dependency

This is useful when you just need to read the theme once without needing to rebuild when the theme changes.

If there is no FolderViewTheme ancestor, returns a default light theme.

Implementation

static FlutterFolderViewTheme maybeOf(BuildContext context) {
  final FolderViewTheme? theme =
      context.getInheritedWidgetOfExactType<FolderViewTheme>();
  return theme?.data ?? FlutterFolderViewTheme.light();
}