Merge pull request #246 from GetStream/nash/add-asserts-to-required
Add assert checks for required params
This commit is contained in:
@@ -66,7 +66,11 @@ class ChannelListCore extends StatefulWidget {
|
||||
this.sort,
|
||||
this.pagination,
|
||||
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.
|
||||
/// Use [ChannelListController.loadData] and [ChannelListController.paginateData] respectively for reloading and pagination.
|
||||
|
||||
@@ -23,7 +23,8 @@ class ChannelsBloc extends StatefulWidget {
|
||||
this.lockChannelsOrder = false,
|
||||
this.channelsComparator,
|
||||
this.shouldAddChannel,
|
||||
}) : super(key: key);
|
||||
}) : assert(child != null),
|
||||
super(key: key);
|
||||
|
||||
/// The 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.
|
||||
///
|
||||
class MessageListCore extends StatefulWidget {
|
||||
/// Instantiate a new [MessageListView]
|
||||
/// Instantiate a new [MessageListView].
|
||||
MessageListCore({
|
||||
Key key,
|
||||
this.showScrollToBottom = true,
|
||||
this.parentMessage,
|
||||
@required this.loadingBuilder,
|
||||
@required this.emptyBuilder,
|
||||
@required this.messageListBuilder,
|
||||
@required this.errorWidgetBuilder,
|
||||
this.showScrollToBottom = true,
|
||||
this.parentMessage,
|
||||
this.messageListController,
|
||||
}) : super(key: key);
|
||||
}) : assert(loadingBuilder != null),
|
||||
assert(emptyBuilder != null),
|
||||
assert(messageListBuilder != null),
|
||||
assert(errorWidgetBuilder != null),
|
||||
super(key: key);
|
||||
|
||||
/// A [MessageListController] allows pagination.
|
||||
/// Use [ChannelListController.paginateData] pagination.
|
||||
|
||||
@@ -16,7 +16,8 @@ class MessageSearchBloc extends StatefulWidget {
|
||||
const MessageSearchBloc({
|
||||
Key key,
|
||||
@required this.child,
|
||||
}) : super(key: key);
|
||||
}) : assert(child != null),
|
||||
super(key: key);
|
||||
|
||||
/// The widget child
|
||||
final Widget child;
|
||||
|
||||
@@ -50,7 +50,11 @@ class MessageSearchListCore extends StatefulWidget {
|
||||
this.paginationParams,
|
||||
this.messageFilters,
|
||||
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.
|
||||
/// Use [MessageSearchListController.loadData] and [MessageSearchListController.paginateData] respectively for reloading and pagination.
|
||||
|
||||
@@ -40,7 +40,9 @@ class StreamChatCore extends StatefulWidget {
|
||||
Key key,
|
||||
@required this.client,
|
||||
@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
|
||||
/// 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
|
||||
/// [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
|
||||
/// and not null.
|
||||
class UserListCore extends StatefulWidget {
|
||||
@@ -67,7 +66,11 @@ class UserListCore extends StatefulWidget {
|
||||
this.pagination,
|
||||
this.groupAlphabetically = false,
|
||||
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.
|
||||
/// Use [UserListController.loadData] and [UserListController.paginateData] respectively for reloading and pagination.
|
||||
|
||||
@@ -16,7 +16,8 @@ class UsersBloc extends StatefulWidget {
|
||||
const UsersBloc({
|
||||
Key key,
|
||||
@required this.child,
|
||||
}) : super(key: key);
|
||||
}) : assert(child != null),
|
||||
super(key: key);
|
||||
|
||||
/// The widget child
|
||||
final Widget child;
|
||||
|
||||
Reference in New Issue
Block a user