of<T extends PresetValue<T>> static method

T? of<T extends PresetValue<T>>(
  1. BuildContext context
)

Retrieve an instance of PresetValue of type T from context. If context doesn't contain any PresetValue instance of type T, this method will return null.

Implementation

static T? of<T extends PresetValue<T>>(BuildContext context) {
  //...
  try {
    return Theme.of(context).extension<T>()!;
  } catch (e) {
    return null;
  }
}