of static method

The WiredashController from the closest Wiredash instance that encloses the given context.

Use it to start Wiredash

Wiredash.of(context).show();

Implementation

static WiredashController of(BuildContext context) {
  final state = context.findAncestorStateOfType<WiredashState>();
  if (state == null) {
    throw StateError('Could not find WiredashState in ancestors');
  }
  // cache context in a short lived object like the widget
  // it gets later retrieved by the `show()` method to read the theme
  state.widget.showBuildContext = context;
  return WiredashController(state._services.wiredashModel);
}