of static method

TextDirection of(
  1. Context context
)

The text direction from the closest instance of this class that encloses the given context.

If there is no Directionality ancestor widget in the tree at the given context, then this will return TextDirection.ltr.

Typical usage is as follows:

TextDirection textDirection = Directionality.of(context);

Implementation

static TextDirection of(Context context) {
  final inherited = context.dependsOn<InheritedDirectionality>();
  return inherited?.textDirection ?? TextDirection.ltr;
}