of static method

The SkeletonizerConfigData instance of the closest ancestor Theme.extension if not found it will throw an exception

Implementation

static SkeletonizerConfigData of(BuildContext context) {
  final SkeletonizerConfig? inherited =
      context.dependOnInheritedWidgetOfExactType<SkeletonizerConfig>();
  late final fromThemeExtension =
      Theme.of(context).extension<SkeletonizerConfigData>();
  assert(() {
    if (inherited == null && fromThemeExtension == null) {
      throw FlutterError(
          'SkeletonizerConfig.of() called with a context that does not contain a SkeletonizerConfigData.\n'
          'try wrapping the context with SkeletonizerConfig widget or provide the data using Theme.extension');
    }
    return true;
  }());
  return inherited?.data ?? fromThemeExtension!;
}