Merge branch 'develop' into hotfix/messagePagination
This commit is contained in:
@@ -43,10 +43,10 @@ class StreamExample extends StatelessWidget {
|
||||
/// To initialize this example, an instance of
|
||||
/// [client] and [channel] is required.
|
||||
const StreamExample({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.client,
|
||||
required this.channel,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
/// Instance of [StreamChatClient] we created earlier.
|
||||
/// This contains information about our application and connection state.
|
||||
@@ -67,9 +67,9 @@ class StreamExample extends StatelessWidget {
|
||||
class HomeScreen extends StatelessWidget {
|
||||
/// [HomeScreen] is constructed using the [Channel] we defined earlier.
|
||||
const HomeScreen({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.channel,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
/// Channel object containing the [Channel.id] we'd like to observe.
|
||||
final Channel channel;
|
||||
@@ -119,10 +119,10 @@ class HomeScreen extends StatelessWidget {
|
||||
class MessageView extends StatefulWidget {
|
||||
/// Message takes the latest list of messages and the current channel.
|
||||
const MessageView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.messages,
|
||||
required this.channel,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
/// List of messages sent in the given channel.
|
||||
final List<Message> messages;
|
||||
|
||||
@@ -5,7 +5,7 @@ publish_to: "none"
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: '>=2.17.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
cupertino_icons: ^1.0.0
|
||||
|
||||
@@ -2173,7 +2173,7 @@ class ChannelClientState {
|
||||
|
||||
/// The channel threads related to this channel.
|
||||
Map<String, List<Message>> get threads =>
|
||||
_threadsController.value.map((key, value) => MapEntry(key, value));
|
||||
_threadsController.value.map(MapEntry.new);
|
||||
|
||||
/// The channel threads related to this channel as a stream.
|
||||
Stream<Map<String, List<Message>>> get threadsStream =>
|
||||
|
||||
@@ -21,9 +21,9 @@ class StreamChatError with EquatableMixin implements Exception {
|
||||
class StreamWebSocketError extends StreamChatError {
|
||||
///
|
||||
const StreamWebSocketError(
|
||||
String message, {
|
||||
super.message, {
|
||||
this.data,
|
||||
}) : super(message);
|
||||
});
|
||||
|
||||
///
|
||||
factory StreamWebSocketError.fromStreamError(Map<String, Object?> error) {
|
||||
|
||||
@@ -6,14 +6,11 @@ class StreamChatDioError extends DioError {
|
||||
/// Initialize a stream chat dio error
|
||||
StreamChatDioError({
|
||||
required this.error,
|
||||
required RequestOptions requestOptions,
|
||||
Response? response,
|
||||
DioErrorType type = DioErrorType.other,
|
||||
required super.requestOptions,
|
||||
super.response,
|
||||
super.type,
|
||||
}) : super(
|
||||
error: error,
|
||||
requestOptions: requestOptions,
|
||||
response: response,
|
||||
type: type,
|
||||
);
|
||||
|
||||
@override
|
||||
|
||||
@@ -136,19 +136,21 @@ class _$UploadStateCopyWithImpl<$Res> implements $UploadStateCopyWith<$Res> {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PreparingCopyWith<$Res> {
|
||||
factory $PreparingCopyWith(Preparing value, $Res Function(Preparing) then) =
|
||||
_$PreparingCopyWithImpl<$Res>;
|
||||
abstract class _$$PreparingCopyWith<$Res> {
|
||||
factory _$$PreparingCopyWith(
|
||||
_$Preparing value, $Res Function(_$Preparing) then) =
|
||||
__$$PreparingCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements $PreparingCopyWith<$Res> {
|
||||
_$PreparingCopyWithImpl(Preparing _value, $Res Function(Preparing) _then)
|
||||
: super(_value, (v) => _then(v as Preparing));
|
||||
class __$$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements _$$PreparingCopyWith<$Res> {
|
||||
__$$PreparingCopyWithImpl(
|
||||
_$Preparing _value, $Res Function(_$Preparing) _then)
|
||||
: super(_value, (v) => _then(v as _$Preparing));
|
||||
|
||||
@override
|
||||
Preparing get _value => super._value as Preparing;
|
||||
_$Preparing get _value => super._value as _$Preparing;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -170,7 +172,7 @@ class _$Preparing implements Preparing {
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is Preparing);
|
||||
(other.runtimeType == runtimeType && other is _$Preparing);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -263,28 +265,29 @@ abstract class Preparing implements UploadState {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $InProgressCopyWith<$Res> {
|
||||
factory $InProgressCopyWith(
|
||||
InProgress value, $Res Function(InProgress) then) =
|
||||
_$InProgressCopyWithImpl<$Res>;
|
||||
abstract class _$$InProgressCopyWith<$Res> {
|
||||
factory _$$InProgressCopyWith(
|
||||
_$InProgress value, $Res Function(_$InProgress) then) =
|
||||
__$$InProgressCopyWithImpl<$Res>;
|
||||
$Res call({int uploaded, int total});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements $InProgressCopyWith<$Res> {
|
||||
_$InProgressCopyWithImpl(InProgress _value, $Res Function(InProgress) _then)
|
||||
: super(_value, (v) => _then(v as InProgress));
|
||||
class __$$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements _$$InProgressCopyWith<$Res> {
|
||||
__$$InProgressCopyWithImpl(
|
||||
_$InProgress _value, $Res Function(_$InProgress) _then)
|
||||
: super(_value, (v) => _then(v as _$InProgress));
|
||||
|
||||
@override
|
||||
InProgress get _value => super._value as InProgress;
|
||||
_$InProgress get _value => super._value as _$InProgress;
|
||||
|
||||
@override
|
||||
$Res call({
|
||||
Object? uploaded = freezed,
|
||||
Object? total = freezed,
|
||||
}) {
|
||||
return _then(InProgress(
|
||||
return _then(_$InProgress(
|
||||
uploaded: uploaded == freezed
|
||||
? _value.uploaded
|
||||
: uploaded // ignore: cast_nullable_to_non_nullable
|
||||
@@ -324,7 +327,7 @@ class _$InProgress implements InProgress {
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is InProgress &&
|
||||
other is _$InProgress &&
|
||||
const DeepCollectionEquality().equals(other.uploaded, uploaded) &&
|
||||
const DeepCollectionEquality().equals(other.total, total));
|
||||
}
|
||||
@@ -337,8 +340,8 @@ class _$InProgress implements InProgress {
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
$InProgressCopyWith<InProgress> get copyWith =>
|
||||
_$InProgressCopyWithImpl<InProgress>(this, _$identity);
|
||||
_$$InProgressCopyWith<_$InProgress> get copyWith =>
|
||||
__$$InProgressCopyWithImpl<_$InProgress>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
@@ -430,24 +433,24 @@ abstract class InProgress implements UploadState {
|
||||
int get uploaded;
|
||||
int get total;
|
||||
@JsonKey(ignore: true)
|
||||
$InProgressCopyWith<InProgress> get copyWith =>
|
||||
_$$InProgressCopyWith<_$InProgress> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SuccessCopyWith<$Res> {
|
||||
factory $SuccessCopyWith(Success value, $Res Function(Success) then) =
|
||||
_$SuccessCopyWithImpl<$Res>;
|
||||
abstract class _$$SuccessCopyWith<$Res> {
|
||||
factory _$$SuccessCopyWith(_$Success value, $Res Function(_$Success) then) =
|
||||
__$$SuccessCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements $SuccessCopyWith<$Res> {
|
||||
_$SuccessCopyWithImpl(Success _value, $Res Function(Success) _then)
|
||||
: super(_value, (v) => _then(v as Success));
|
||||
class __$$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements _$$SuccessCopyWith<$Res> {
|
||||
__$$SuccessCopyWithImpl(_$Success _value, $Res Function(_$Success) _then)
|
||||
: super(_value, (v) => _then(v as _$Success));
|
||||
|
||||
@override
|
||||
Success get _value => super._value as Success;
|
||||
_$Success get _value => super._value as _$Success;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -469,7 +472,7 @@ class _$Success implements Success {
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is Success);
|
||||
(other.runtimeType == runtimeType && other is _$Success);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -562,26 +565,26 @@ abstract class Success implements UploadState {
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $FailedCopyWith<$Res> {
|
||||
factory $FailedCopyWith(Failed value, $Res Function(Failed) then) =
|
||||
_$FailedCopyWithImpl<$Res>;
|
||||
abstract class _$$FailedCopyWith<$Res> {
|
||||
factory _$$FailedCopyWith(_$Failed value, $Res Function(_$Failed) then) =
|
||||
__$$FailedCopyWithImpl<$Res>;
|
||||
$Res call({String error});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements $FailedCopyWith<$Res> {
|
||||
_$FailedCopyWithImpl(Failed _value, $Res Function(Failed) _then)
|
||||
: super(_value, (v) => _then(v as Failed));
|
||||
class __$$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
implements _$$FailedCopyWith<$Res> {
|
||||
__$$FailedCopyWithImpl(_$Failed _value, $Res Function(_$Failed) _then)
|
||||
: super(_value, (v) => _then(v as _$Failed));
|
||||
|
||||
@override
|
||||
Failed get _value => super._value as Failed;
|
||||
_$Failed get _value => super._value as _$Failed;
|
||||
|
||||
@override
|
||||
$Res call({
|
||||
Object? error = freezed,
|
||||
}) {
|
||||
return _then(Failed(
|
||||
return _then(_$Failed(
|
||||
error: error == freezed
|
||||
? _value.error
|
||||
: error // ignore: cast_nullable_to_non_nullable
|
||||
@@ -614,7 +617,7 @@ class _$Failed implements Failed {
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is Failed &&
|
||||
other is _$Failed &&
|
||||
const DeepCollectionEquality().equals(other.error, error));
|
||||
}
|
||||
|
||||
@@ -624,8 +627,8 @@ class _$Failed implements Failed {
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
$FailedCopyWith<Failed> get copyWith =>
|
||||
_$FailedCopyWithImpl<Failed>(this, _$identity);
|
||||
_$$FailedCopyWith<_$Failed> get copyWith =>
|
||||
__$$FailedCopyWithImpl<_$Failed>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
@@ -714,5 +717,6 @@ abstract class Failed implements UploadState {
|
||||
|
||||
String get error;
|
||||
@JsonKey(ignore: true)
|
||||
$FailedCopyWith<Failed> get copyWith => throw _privateConstructorUsedError;
|
||||
_$$FailedCopyWith<_$Failed> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@@ -177,36 +177,21 @@ class EventChannel extends ChannelModel {
|
||||
/// Constructor used for json serialization
|
||||
EventChannel({
|
||||
this.members,
|
||||
String? id,
|
||||
String? type,
|
||||
required String cid,
|
||||
required ChannelConfig config,
|
||||
User? createdBy,
|
||||
bool frozen = false,
|
||||
DateTime? lastMessageAt,
|
||||
required DateTime createdAt,
|
||||
required DateTime updatedAt,
|
||||
DateTime? deletedAt,
|
||||
int memberCount = 0,
|
||||
super.id,
|
||||
super.type,
|
||||
required String super.cid,
|
||||
required ChannelConfig super.config,
|
||||
super.createdBy,
|
||||
super.frozen,
|
||||
super.lastMessageAt,
|
||||
required DateTime super.createdAt,
|
||||
required DateTime super.updatedAt,
|
||||
super.deletedAt,
|
||||
super.memberCount,
|
||||
Map<String, Object?>? extraData,
|
||||
int cooldown = 0,
|
||||
String? team,
|
||||
}) : super(
|
||||
id: id,
|
||||
type: type,
|
||||
cid: cid,
|
||||
config: config,
|
||||
createdBy: createdBy,
|
||||
frozen: frozen,
|
||||
lastMessageAt: lastMessageAt,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
deletedAt: deletedAt,
|
||||
memberCount: memberCount,
|
||||
extraData: extraData ?? {},
|
||||
cooldown: cooldown,
|
||||
team: team,
|
||||
);
|
||||
super.cooldown,
|
||||
super.team,
|
||||
}) : super(extraData: extraData ?? {});
|
||||
|
||||
/// Create a new instance from a json
|
||||
factory EventChannel.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -60,21 +60,21 @@ enum FilterOperator {
|
||||
extension FilterOperatorX on FilterOperator {
|
||||
/// Converts [FilterOperator] into rew values
|
||||
String get rawValue => {
|
||||
FilterOperator.equal: '\$eq',
|
||||
FilterOperator.notEqual: '\$ne',
|
||||
FilterOperator.greater: '\$gt',
|
||||
FilterOperator.greaterOrEqual: '\$gte',
|
||||
FilterOperator.less: '\$lt',
|
||||
FilterOperator.lessOrEqual: '\$lte',
|
||||
FilterOperator.in_: '\$in',
|
||||
FilterOperator.notIn: '\$nin',
|
||||
FilterOperator.query: '\$q',
|
||||
FilterOperator.autoComplete: '\$autocomplete',
|
||||
FilterOperator.exists: '\$exists',
|
||||
FilterOperator.and: '\$and',
|
||||
FilterOperator.or: '\$or',
|
||||
FilterOperator.nor: '\$nor',
|
||||
FilterOperator.contains: '\$contains',
|
||||
FilterOperator.equal: r'$eq',
|
||||
FilterOperator.notEqual: r'$ne',
|
||||
FilterOperator.greater: r'$gt',
|
||||
FilterOperator.greaterOrEqual: r'$gte',
|
||||
FilterOperator.less: r'$lt',
|
||||
FilterOperator.lessOrEqual: r'$lte',
|
||||
FilterOperator.in_: r'$in',
|
||||
FilterOperator.notIn: r'$nin',
|
||||
FilterOperator.query: r'$q',
|
||||
FilterOperator.autoComplete: r'$autocomplete',
|
||||
FilterOperator.exists: r'$exists',
|
||||
FilterOperator.and: r'$and',
|
||||
FilterOperator.or: r'$or',
|
||||
FilterOperator.nor: r'$nor',
|
||||
FilterOperator.contains: r'$contains',
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,34 +17,20 @@ class OwnUser extends User {
|
||||
this.totalUnreadCount = 0,
|
||||
this.unreadChannels = 0,
|
||||
this.channelMutes = const [],
|
||||
required String id,
|
||||
String? role,
|
||||
String? name,
|
||||
String? image,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
DateTime? lastActive,
|
||||
bool online = false,
|
||||
Map<String, Object?> extraData = const {},
|
||||
bool banned = false,
|
||||
DateTime? banExpires,
|
||||
List<String> teams = const [],
|
||||
String? language,
|
||||
}) : super(
|
||||
id: id,
|
||||
role: role,
|
||||
name: name,
|
||||
image: image,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
lastActive: lastActive,
|
||||
online: online,
|
||||
extraData: extraData,
|
||||
banned: banned,
|
||||
banExpires: banExpires,
|
||||
teams: teams,
|
||||
language: language,
|
||||
);
|
||||
required super.id,
|
||||
super.role,
|
||||
super.name,
|
||||
super.image,
|
||||
super.createdAt,
|
||||
super.updatedAt,
|
||||
super.lastActive,
|
||||
super.online,
|
||||
super.extraData,
|
||||
super.banned,
|
||||
super.banExpires,
|
||||
super.teams,
|
||||
super.language,
|
||||
});
|
||||
|
||||
/// Create a new instance from json.
|
||||
factory OwnUser.fromJson(Map<String, dynamic> json) => _$OwnUserFromJson(
|
||||
|
||||
@@ -6,17 +6,17 @@ repository: https://github.com/GetStream/stream-chat-flutter
|
||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: '>=2.17.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
async: ^2.5.0
|
||||
collection: ^1.15.0
|
||||
dio: ^4.0.0
|
||||
equatable: ^2.0.0
|
||||
freezed_annotation: ^1.0.0
|
||||
freezed_annotation: ^2.0.3
|
||||
http_parser: ^4.0.0
|
||||
jose: ^0.3.2
|
||||
json_annotation: ^4.3.0
|
||||
json_annotation: ^4.5.0
|
||||
logging: ^1.0.1
|
||||
meta: ^1.3.0
|
||||
mime: ^1.0.0
|
||||
@@ -28,7 +28,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
build_runner: ^2.0.1
|
||||
dart_code_metrics: ^4.4.0
|
||||
freezed: ^1.0.0
|
||||
json_serializable: ^6.0.1
|
||||
freezed: ^2.0.3
|
||||
json_serializable: ^6.2.0
|
||||
mocktail: ^0.3.0
|
||||
test: ^1.17.12
|
||||
@@ -49,6 +49,7 @@ void main() {
|
||||
channel: ChannelModel.fromJson(j['channel']),
|
||||
members: [],
|
||||
messages:
|
||||
// ignore: unnecessary_lambdas
|
||||
(j['messages'] as List).map((m) => Message.fromJson(m)).toList(),
|
||||
read: [],
|
||||
watcherCount: 5,
|
||||
|
||||
@@ -123,7 +123,7 @@ void main() {
|
||||
test('custom', () {
|
||||
const key = 'testKey';
|
||||
const value = 'testValue';
|
||||
const operator = '\$customOperator';
|
||||
const operator = r'$customOperator';
|
||||
const filter = Filter.custom(operator: operator, key: key, value: value);
|
||||
expect(filter.key, key);
|
||||
expect(filter.value, value);
|
||||
|
||||
Reference in New Issue
Block a user