StreamChatConfigurationData class

Provides global, user-configurable, non-theme related configuration options to Flutter applications that use Stream Chat.

In order to set these configuration options, you must pass an instance of this class to the StreamChat widget, or wrap a subtree using the StreamChatConfiguration inherited widget.

If you need to access the configuration directly at a later point in your application, you can use the StreamChatConfiguration.of method to retrieve it.

If no StreamChatConfigurationData is provided, the StreamChatConfiguration.defaults factory constructor is used to provide a default configuration.

If you want to keep some of the default values, but not others, you can use the StreamChatConfigurationData.copyWith method to override the values in question.

Example 1:

class MyApp extends StatelessWidget {
  const MyApp({
    required this.client,
  });

  final StreamChatClient client;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        child: StreamChat(
          client: client,
          // No configuration provided, so the defaults are used.
          child: ChannelListPage(),
        ),
      ),
    );
  }
}

Example 2:

class MyApp extends StatelessWidget {
  const MyApp({
    required this.client,
  });

  final StreamChatClient client;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        child: StreamChat(
          client: client,
          config: StreamChatConfiguration.defaults().copyWith(
            // Override a specific default value here
          ),
          child: ChannelListPage(),
        ),
      ),
    );
  }
}

Constructors

StreamChatConfigurationData({Widget loadingIndicator = const StreamLoadingIndicator(), Widget defaultUserImage(BuildContext, User)?, Widget placeholderUserImage(BuildContext, User)?, List<StreamReactionIcon>? reactionIcons, bool? enforceUniqueReactions})
Provides global, user-configurable, non-theme related configuration options to Flutter applications that use Stream Chat.
factory

Properties

defaultUserImage Widget Function(BuildContext, User)
The widget that will be built when the user image is unavailable.
final
enforceUniqueReactions bool
Whether a new reaction should replace the existing one.
final
hashCode int
The hash code for this object.
no setterinherited
loadingIndicator Widget
The widget that will be shown to indicate loading.
final
placeholderUserImage → (Widget Function(BuildContext, User)?)
The widget that will be built when the user image is loading.
final
reactionIcons List<StreamReactionIcon>
Assets used for rendering reactions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Widget? loadingIndicator, Widget defaultUserImage(BuildContext, User)?, Widget placeholderUserImage(BuildContext, User)?, List<StreamReactionIcon>? reactionIcons, bool? enforceUniqueReactions}) StreamChatConfigurationData
Copies the configuration options from one StreamChatConfigurationData to another.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited