maybeParagraphSpacingOverrideOf static method

double? maybeParagraphSpacingOverrideOf(
  1. BuildContext context
)

Returns the MediaQueryData.paragraphSpacingOverride for the nearest MediaQuery ancestor or null, if no such ancestor exists or if the platform has not specified an override.

Use of this method will cause the given context to rebuild any time that the MediaQueryData.paragraphSpacingOverride property of the ancestor MediaQuery changes.

Prefer using this function over getting the attribute directly from the MediaQueryData returned from maybeOf, because using this function will only rebuild the context when this specific attribute changes, not when any attribute changes.

Implementation

// TODO(Renzo-Olivares): Investigate ways the framework can automatically
// apply this override to its own text components.
// See: https://github.com/flutter/flutter/issues/177953 and https://github.com/flutter/flutter/issues/177408.
static double? maybeParagraphSpacingOverrideOf(BuildContext context) =>
    _maybeOf(context, _MediaQueryAspect.paragraphSpacingOverride)?.paragraphSpacingOverride;