read<T extends Service> method

T read<T extends Service>()

Implementation

T read<T extends Service>() {
  final res = getElementForInheritedWidgetOfExactType<ServiceWidget<T>>();
  if (res == null) {
    throw StateError(
        '${ServiceWidget<T>} instance has never been included on the widget tree');
  }
  return res as T;
}