of static method

Lookup is safe in event handlers and state initialization, and does not establish an inherited dependency before initState has finished.

Implementation

static ChatPlatformServices of(BuildContext context) =>
    context.getInheritedWidgetOfExactType<ChatPlatformScope>()?.services ??
    const ChatPlatformServices();