Merge pull request #246 from GetStream/nash/add-asserts-to-required

Add assert checks for required params
This commit is contained in:
Salvatore Giordano
2021-02-01 09:29:28 +01:00
committed by GitHub
8 changed files with 32 additions and 12 deletions
@@ -66,7 +66,11 @@ class ChannelListCore extends StatefulWidget {
this.sort, this.sort,
this.pagination, this.pagination,
this.channelListController, this.channelListController,
}) : super(key: key); }) : assert(errorBuilder != null),
assert(emptyBuilder != null),
assert(loadingBuilder != null),
assert(listBuilder != null),
super(key: key);
/// A [ChannelListController] allows reloading and pagination. /// A [ChannelListController] allows reloading and pagination.
/// Use [ChannelListController.loadData] and [ChannelListController.paginateData] respectively for reloading and pagination. /// Use [ChannelListController.loadData] and [ChannelListController.paginateData] respectively for reloading and pagination.
@@ -23,7 +23,8 @@ class ChannelsBloc extends StatefulWidget {
this.lockChannelsOrder = false, this.lockChannelsOrder = false,
this.channelsComparator, this.channelsComparator,
this.shouldAddChannel, this.shouldAddChannel,
}) : super(key: key); }) : assert(child != null),
super(key: key);
/// The widget child /// The widget child
final Widget child; final Widget child;
@@ -54,17 +54,21 @@ import 'stream_channel.dart';
/// The widget uses a [ListView.custom] to render the list of channels. /// The widget uses a [ListView.custom] to render the list of channels.
/// ///
class MessageListCore extends StatefulWidget { class MessageListCore extends StatefulWidget {
/// Instantiate a new [MessageListView] /// Instantiate a new [MessageListView].
MessageListCore({ MessageListCore({
Key key, Key key,
this.showScrollToBottom = true,
this.parentMessage,
@required this.loadingBuilder, @required this.loadingBuilder,
@required this.emptyBuilder, @required this.emptyBuilder,
@required this.messageListBuilder, @required this.messageListBuilder,
@required this.errorWidgetBuilder, @required this.errorWidgetBuilder,
this.showScrollToBottom = true,
this.parentMessage,
this.messageListController, this.messageListController,
}) : super(key: key); }) : assert(loadingBuilder != null),
assert(emptyBuilder != null),
assert(messageListBuilder != null),
assert(errorWidgetBuilder != null),
super(key: key);
/// A [MessageListController] allows pagination. /// A [MessageListController] allows pagination.
/// Use [ChannelListController.paginateData] pagination. /// Use [ChannelListController.paginateData] pagination.
@@ -16,7 +16,8 @@ class MessageSearchBloc extends StatefulWidget {
const MessageSearchBloc({ const MessageSearchBloc({
Key key, Key key,
@required this.child, @required this.child,
}) : super(key: key); }) : assert(child != null),
super(key: key);
/// The widget child /// The widget child
final Widget child; final Widget child;
@@ -50,7 +50,11 @@ class MessageSearchListCore extends StatefulWidget {
this.paginationParams, this.paginationParams,
this.messageFilters, this.messageFilters,
this.messageSearchListController, this.messageSearchListController,
}) : super(key: key); }) : assert(emptyBuilder != null),
assert(errorBuilder != null),
assert(loadingBuilder != null),
assert(childBuilder != null),
super(key: key);
/// A [MessageSearchListController] allows reloading and pagination. /// A [MessageSearchListController] allows reloading and pagination.
/// Use [MessageSearchListController.loadData] and [MessageSearchListController.paginateData] respectively for reloading and pagination. /// Use [MessageSearchListController.loadData] and [MessageSearchListController.paginateData] respectively for reloading and pagination.
@@ -40,7 +40,9 @@ class StreamChatCore extends StatefulWidget {
Key key, Key key,
@required this.client, @required this.client,
@required this.child, @required this.child,
}) : super(key: key); }) : assert(client != null),
assert(child != null),
super(key: key);
/// Instance of Stream Chat Client containing information about the current /// Instance of Stream Chat Client containing information about the current
/// application. /// application.
@@ -50,7 +50,6 @@ import 'package:stream_chat_flutter_core/src/users_bloc.dart';
/// [UsersBloc] must be the ancestor of this widget. This is necessary since /// [UsersBloc] must be the ancestor of this widget. This is necessary since
/// [UserListCore] depends on functionality contained within [UsersBloc]. /// [UserListCore] depends on functionality contained within [UsersBloc].
/// ///
/// The widget uses a [ListView.separated], [GridView.builder] to render the list, grid of channels.
/// The parameters [listBuilder], [loadingBuilder], [emptyBuilder] and [errorBuilder] must all be supplied /// The parameters [listBuilder], [loadingBuilder], [emptyBuilder] and [errorBuilder] must all be supplied
/// and not null. /// and not null.
class UserListCore extends StatefulWidget { class UserListCore extends StatefulWidget {
@@ -67,7 +66,11 @@ class UserListCore extends StatefulWidget {
this.pagination, this.pagination,
this.groupAlphabetically = false, this.groupAlphabetically = false,
this.userListController, this.userListController,
}) : super(key: key); }) : assert(errorBuilder != null),
assert(emptyBuilder != null),
assert(loadingBuilder != null),
assert(listBuilder != null),
super(key: key);
/// A [UserListController] allows reloading and pagination. /// A [UserListController] allows reloading and pagination.
/// Use [UserListController.loadData] and [UserListController.paginateData] respectively for reloading and pagination. /// Use [UserListController.loadData] and [UserListController.paginateData] respectively for reloading and pagination.
@@ -16,7 +16,8 @@ class UsersBloc extends StatefulWidget {
const UsersBloc({ const UsersBloc({
Key key, Key key,
@required this.child, @required this.child,
}) : super(key: key); }) : assert(child != null),
super(key: key);
/// The widget child /// The widget child
final Widget child; final Widget child;