of<T> static method

FlutterFolderViewTheme<T> of<T>(
  1. BuildContext context
)

Retrieves the FlutterFolderViewTheme from the closest FolderViewTheme ancestor

If there is no FolderViewTheme<T> ancestor, returns a default light theme. In debug builds, a FolderViewTheme of another type above context is reported once through debugPrint.

Example:

final theme = FolderViewTheme.of<MyDataType>(context);
final lineColor = theme.lineTheme.lineColor;

Implementation

static FlutterFolderViewTheme<T> of<T>(BuildContext context) {
  final FolderViewTheme<T>? theme = context
      .dependOnInheritedWidgetOfExactType<FolderViewTheme<T>>();
  if (theme == null) _debugReportTypeMismatch<T>(context);
  return theme?.data ?? FlutterFolderViewTheme<T>.light();
}