of static method

Ditto of(
  1. BuildContext context
)

Returns the Ditto instance registered inside the current context

Implementation

static Ditto of(BuildContext context) {
  final temp = context.findAncestorWidgetOfExactType<InheritedDitto>();
  assert(
    temp != null,
    'Have you added InheritedDitto at the root of your tree?',
  );
  return temp!._ditto;
}