maybeOf static method

TextStyle? maybeOf(
  1. BuildContext context
)

Returns the TextStyle from the closest DefaultTextStyle ancestor, or null if none exists.

Implementation

static TextStyle? maybeOf(BuildContext context) {
  final widget =
      context.dependOnInheritedWidgetOfExactType<DefaultTextStyle>();
  return widget?.style;
}