of static method

Use this method to get the current StreamChatState instance

Implementation

static StreamChatState of(BuildContext context) {
  StreamChatState? streamChatState;

  streamChatState = context.findAncestorStateOfType<StreamChatState>();

  if (streamChatState == null) {
    throw Exception(
      'You must have a StreamChat widget at the top of your widget tree',
    );
  }

  return streamChatState;
}