of<T> static method

GenericItemForm<T>? of<T>(
  1. BuildContext context, {
  2. bool listen = true,
})

Implementation

static GenericItemForm<T>? of<T>(
  BuildContext context, {
  bool listen = true,
}) {
  if (listen) {
    return context
        .dependOnInheritedWidgetOfExactType<
            GenericItemFormInheritedStreamer<T>>()
        ?.form;
  }

  final element = context.getElementForInheritedWidgetOfExactType<
      GenericItemFormInheritedStreamer<T>>();
  return element == null
      ? null
      : (element.widget as GenericItemFormInheritedStreamer<T>).form;
}