I’m invoking the of function of the InheritedWidget, but my function is returning null when, as you can see above, I have my widget at the top of the tree. The call is coming from a page that was pushed onto the Navigator stack, which is not this page. Anyone know why? My InheritedWidget code is below.
class LiveKHProvider extends InheritedWidget {
final LiveKHBloc liveKHBloc = LiveKHBloc();
@override
bool updateShouldNotify(InheritedWidget oldWidget) => oldWidget != this;
static LiveKHBloc of(BuildContext context) {
var inheritFromWidgetOfExactType =
context.inheritFromWidgetOfExactType(LiveKHProvider); // to clearly see what’s returning null.
//This is where it returns null,
//so the below line is executed on a null object.
return (inheritFromWidgetOfExactType as LiveKHProvider).liveKHBloc;
}
LiveKHProvider({Key key, Widget child}) : super(key: key, child: child);
}

context? Is it actually a context from below the inherited widget, or is it a root context?InheritedWidgetcode located, @ThinkDigital? Is it in yourmain.dartfile?