debugging work

This commit is contained in:
Christien Rioux 2025-03-22 21:43:37 -04:00
parent 739df7c427
commit d6b1c20906
71 changed files with 4155 additions and 3616 deletions

View file

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:typed_data';
import 'package:async_tools/async_tools.dart';
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:fixnum/fixnum.dart';
import 'package:flutter/widgets.dart';
@ -184,9 +183,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
emit(_convertMessages(state, avMessagesState));
}
void _onChangedContacts(
BlocBusyState<AsyncValue<IList<DHTShortArrayElementState<proto.Contact>>>>
bavContacts) {
void _onChangedContacts(DHTShortArrayCubitState<proto.Contact> bavContacts) {
// Rewrite users when contacts change
singleFuture((this, _sfChangedContacts), _updateConversationSubscriptions);
}
@ -353,6 +350,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
case proto.Message_Kind.membership:
case proto.Message_Kind.moderation:
case proto.Message_Kind.notSet:
case proto.Message_Kind.readReceipt:
return (currentState, null);
}
}
@ -440,9 +438,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
final Map<TypedKey, StreamSubscription<AsyncValue<ActiveConversationState>>>
_conversationSubscriptions = {};
late StreamSubscription<SingleContactMessagesState> _messagesSubscription;
late StreamSubscription<
BlocBusyState<
AsyncValue<IList<DHTShortArrayElementState<proto.Contact>>>>>
late StreamSubscription<DHTShortArrayCubitState<proto.Contact>>
_contactListSubscription;
double scrollOffset = 0;
}

View file

@ -13,7 +13,7 @@ import 'window_state.dart';
part 'chat_component_state.freezed.dart';
@freezed
class ChatComponentState with _$ChatComponentState {
sealed class ChatComponentState with _$ChatComponentState {
const factory ChatComponentState(
{
// GlobalKey for the chat

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,44 +10,78 @@ part of 'chat_component_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ChatComponentState {
// GlobalKey for the chat
GlobalKey<ChatState> get chatKey =>
throw _privateConstructorUsedError; // ScrollController for the chat
AutoScrollController get scrollController =>
throw _privateConstructorUsedError; // TextEditingController for the chat
InputTextFieldController get textEditingController =>
throw _privateConstructorUsedError; // Local user
User? get localUser =>
throw _privateConstructorUsedError; // Active remote users
IMap<Typed<FixedEncodedString43>, User> get remoteUsers =>
throw _privateConstructorUsedError; // Historical remote users
IMap<Typed<FixedEncodedString43>, User> get historicalRemoteUsers =>
throw _privateConstructorUsedError; // Unknown users
IMap<Typed<FixedEncodedString43>, User> get unknownUsers =>
throw _privateConstructorUsedError; // Messages state
AsyncValue<WindowState<Message>> get messageWindow =>
throw _privateConstructorUsedError; // Title of the chat
String get title => throw _privateConstructorUsedError;
GlobalKey<ChatState> get chatKey; // ScrollController for the chat
AutoScrollController
get scrollController; // TextEditingController for the chat
InputTextFieldController get textEditingController; // Local user
User? get localUser; // Active remote users
IMap<TypedKey, User> get remoteUsers; // Historical remote users
IMap<TypedKey, User> get historicalRemoteUsers; // Unknown users
IMap<TypedKey, User> get unknownUsers; // Messages state
AsyncValue<WindowState<Message>> get messageWindow; // Title of the chat
String get title;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChatComponentStateCopyWith<ChatComponentState> get copyWith =>
throw _privateConstructorUsedError;
_$ChatComponentStateCopyWithImpl<ChatComponentState>(
this as ChatComponentState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ChatComponentState &&
(identical(other.chatKey, chatKey) || other.chatKey == chatKey) &&
(identical(other.scrollController, scrollController) ||
other.scrollController == scrollController) &&
(identical(other.textEditingController, textEditingController) ||
other.textEditingController == textEditingController) &&
(identical(other.localUser, localUser) ||
other.localUser == localUser) &&
(identical(other.remoteUsers, remoteUsers) ||
other.remoteUsers == remoteUsers) &&
(identical(other.historicalRemoteUsers, historicalRemoteUsers) ||
other.historicalRemoteUsers == historicalRemoteUsers) &&
(identical(other.unknownUsers, unknownUsers) ||
other.unknownUsers == unknownUsers) &&
(identical(other.messageWindow, messageWindow) ||
other.messageWindow == messageWindow) &&
(identical(other.title, title) || other.title == title));
}
@override
int get hashCode => Object.hash(
runtimeType,
chatKey,
scrollController,
textEditingController,
localUser,
remoteUsers,
historicalRemoteUsers,
unknownUsers,
messageWindow,
title);
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
}
/// @nodoc
abstract class $ChatComponentStateCopyWith<$Res> {
abstract mixin class $ChatComponentStateCopyWith<$Res> {
factory $ChatComponentStateCopyWith(
ChatComponentState value, $Res Function(ChatComponentState) then) =
_$ChatComponentStateCopyWithImpl<$Res, ChatComponentState>;
ChatComponentState value, $Res Function(ChatComponentState) _then) =
_$ChatComponentStateCopyWithImpl;
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
@ -63,14 +98,12 @@ abstract class $ChatComponentStateCopyWith<$Res> {
}
/// @nodoc
class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
class _$ChatComponentStateCopyWithImpl<$Res>
implements $ChatComponentStateCopyWith<$Res> {
_$ChatComponentStateCopyWithImpl(this._value, this._then);
_$ChatComponentStateCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final ChatComponentState _self;
final $Res Function(ChatComponentState) _then;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@ -87,44 +120,44 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_value.copyWith(
return _then(_self.copyWith(
chatKey: null == chatKey
? _value.chatKey
? _self.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _value.scrollController
? _self.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _value.textEditingController
? _self.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _value.localUser
? _self.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _value.remoteUsers
? _self.remoteUsers!
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _value.historicalRemoteUsers
? _self.historicalRemoteUsers!
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _value.unknownUsers
? _self.unknownUsers!
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _value.messageWindow
? _self.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _value.title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
));
}
/// Create a copy of ChatComponentState
@ -132,104 +165,17 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
@override
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_value.messageWindow,
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_self.messageWindow,
(value) {
return _then(_value.copyWith(messageWindow: value) as $Val);
return _then(_self.copyWith(messageWindow: value));
});
}
}
/// @nodoc
abstract class _$$ChatComponentStateImplCopyWith<$Res>
implements $ChatComponentStateCopyWith<$Res> {
factory _$$ChatComponentStateImplCopyWith(_$ChatComponentStateImpl value,
$Res Function(_$ChatComponentStateImpl) then) =
__$$ChatComponentStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
AutoScrollController scrollController,
InputTextFieldController textEditingController,
User? localUser,
IMap<Typed<FixedEncodedString43>, User> remoteUsers,
IMap<Typed<FixedEncodedString43>, User> historicalRemoteUsers,
IMap<Typed<FixedEncodedString43>, User> unknownUsers,
AsyncValue<WindowState<Message>> messageWindow,
String title});
@override
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow;
}
/// @nodoc
class __$$ChatComponentStateImplCopyWithImpl<$Res>
extends _$ChatComponentStateCopyWithImpl<$Res, _$ChatComponentStateImpl>
implements _$$ChatComponentStateImplCopyWith<$Res> {
__$$ChatComponentStateImplCopyWithImpl(_$ChatComponentStateImpl _value,
$Res Function(_$ChatComponentStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? chatKey = null,
Object? scrollController = null,
Object? textEditingController = null,
Object? localUser = freezed,
Object? remoteUsers = null,
Object? historicalRemoteUsers = null,
Object? unknownUsers = null,
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_$ChatComponentStateImpl(
chatKey: null == chatKey
? _value.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _value.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _value.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _value.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _value.remoteUsers
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _value.historicalRemoteUsers
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _value.unknownUsers
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _value.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ChatComponentStateImpl implements _ChatComponentState {
const _$ChatComponentStateImpl(
class _ChatComponentState implements ChatComponentState {
const _ChatComponentState(
{required this.chatKey,
required this.scrollController,
required this.textEditingController,
@ -268,16 +214,19 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
@override
final String title;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChatComponentStateCopyWith<_ChatComponentState> get copyWith =>
__$ChatComponentStateCopyWithImpl<_ChatComponentState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatComponentStateImpl &&
other is _ChatComponentState &&
(identical(other.chatKey, chatKey) || other.chatKey == chatKey) &&
(identical(other.scrollController, scrollController) ||
other.scrollController == scrollController) &&
@ -309,56 +258,108 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
messageWindow,
title);
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
}
/// @nodoc
abstract mixin class _$ChatComponentStateCopyWith<$Res>
implements $ChatComponentStateCopyWith<$Res> {
factory _$ChatComponentStateCopyWith(
_ChatComponentState value, $Res Function(_ChatComponentState) _then) =
__$ChatComponentStateCopyWithImpl;
@override
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
AutoScrollController scrollController,
InputTextFieldController textEditingController,
User? localUser,
IMap<Typed<FixedEncodedString43>, User> remoteUsers,
IMap<Typed<FixedEncodedString43>, User> historicalRemoteUsers,
IMap<Typed<FixedEncodedString43>, User> unknownUsers,
AsyncValue<WindowState<Message>> messageWindow,
String title});
@override
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow;
}
/// @nodoc
class __$ChatComponentStateCopyWithImpl<$Res>
implements _$ChatComponentStateCopyWith<$Res> {
__$ChatComponentStateCopyWithImpl(this._self, this._then);
final _ChatComponentState _self;
final $Res Function(_ChatComponentState) _then;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith =>
__$$ChatComponentStateImplCopyWithImpl<_$ChatComponentStateImpl>(
this, _$identity);
}
abstract class _ChatComponentState implements ChatComponentState {
const factory _ChatComponentState(
{required final GlobalKey<ChatState> chatKey,
required final AutoScrollController scrollController,
required final InputTextFieldController textEditingController,
required final User? localUser,
required final IMap<Typed<FixedEncodedString43>, User> remoteUsers,
required final IMap<Typed<FixedEncodedString43>, User>
historicalRemoteUsers,
required final IMap<Typed<FixedEncodedString43>, User> unknownUsers,
required final AsyncValue<WindowState<Message>> messageWindow,
required final String title}) = _$ChatComponentStateImpl;
// GlobalKey for the chat
@override
GlobalKey<ChatState> get chatKey; // ScrollController for the chat
@override
AutoScrollController
get scrollController; // TextEditingController for the chat
@override
InputTextFieldController get textEditingController; // Local user
@override
User? get localUser; // Active remote users
@override
IMap<Typed<FixedEncodedString43>, User>
get remoteUsers; // Historical remote users
@override
IMap<Typed<FixedEncodedString43>, User>
get historicalRemoteUsers; // Unknown users
@override
IMap<Typed<FixedEncodedString43>, User> get unknownUsers; // Messages state
@override
AsyncValue<WindowState<Message>> get messageWindow; // Title of the chat
@override
String get title;
$Res call({
Object? chatKey = null,
Object? scrollController = null,
Object? textEditingController = null,
Object? localUser = freezed,
Object? remoteUsers = null,
Object? historicalRemoteUsers = null,
Object? unknownUsers = null,
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_ChatComponentState(
chatKey: null == chatKey
? _self.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _self.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _self.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _self.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _self.remoteUsers
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _self.historicalRemoteUsers
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _self.unknownUsers
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _self.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_self.messageWindow,
(value) {
return _then(_self.copyWith(messageWindow: value));
});
}
}
// dart format on

View file

@ -24,7 +24,7 @@ enum MessageSendState {
}
@freezed
class MessageState with _$MessageState {
sealed class MessageState with _$MessageState {
const factory MessageState({
// Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,99 +10,69 @@ part of 'message_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
MessageState _$MessageStateFromJson(Map<String, dynamic> json) {
return _MessageState.fromJson(json);
}
/// @nodoc
mixin _$MessageState {
mixin _$MessageState implements DiagnosticableTreeMixin {
// Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message get content =>
throw _privateConstructorUsedError; // Sent timestamp
Timestamp get sentTimestamp =>
throw _privateConstructorUsedError; // Reconciled timestamp
Timestamp? get reconciledTimestamp =>
throw _privateConstructorUsedError; // The state of the message
MessageSendState? get sendState => throw _privateConstructorUsedError;
/// Serializes this MessageState to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
proto.Message get content; // Sent timestamp
Timestamp get sentTimestamp; // Reconciled timestamp
Timestamp? get reconciledTimestamp; // The state of the message
MessageSendState? get sendState;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$MessageStateCopyWith<MessageState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MessageStateCopyWith<$Res> {
factory $MessageStateCopyWith(
MessageState value, $Res Function(MessageState) then) =
_$MessageStateCopyWithImpl<$Res, MessageState>;
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
/// @nodoc
class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState>
implements $MessageStateCopyWith<$Res> {
_$MessageStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$MessageStateCopyWith<MessageState> get copyWith =>
_$MessageStateCopyWithImpl<MessageState>(
this as MessageState, _$identity);
/// Serializes this MessageState to a JSON map.
Map<String, dynamic> toJson();
@override
$Res call({
Object? content = null,
Object? sentTimestamp = null,
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_value.copyWith(
content: null == content
? _value.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _value.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _value.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _value.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
) as $Val);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
properties
..add(DiagnosticsProperty('type', 'MessageState'))
..add(DiagnosticsProperty('content', content))
..add(DiagnosticsProperty('sentTimestamp', sentTimestamp))
..add(DiagnosticsProperty('reconciledTimestamp', reconciledTimestamp))
..add(DiagnosticsProperty('sendState', sendState));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MessageState &&
(identical(other.content, content) || other.content == content) &&
(identical(other.sentTimestamp, sentTimestamp) ||
other.sentTimestamp == sentTimestamp) &&
(identical(other.reconciledTimestamp, reconciledTimestamp) ||
other.reconciledTimestamp == reconciledTimestamp) &&
(identical(other.sendState, sendState) ||
other.sendState == sendState));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, content, sentTimestamp, reconciledTimestamp, sendState);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
}
}
/// @nodoc
abstract class _$$MessageStateImplCopyWith<$Res>
implements $MessageStateCopyWith<$Res> {
factory _$$MessageStateImplCopyWith(
_$MessageStateImpl value, $Res Function(_$MessageStateImpl) then) =
__$$MessageStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $MessageStateCopyWith<$Res> {
factory $MessageStateCopyWith(
MessageState value, $Res Function(MessageState) _then) =
_$MessageStateCopyWithImpl;
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
@ -112,12 +83,11 @@ abstract class _$$MessageStateImplCopyWith<$Res>
}
/// @nodoc
class __$$MessageStateImplCopyWithImpl<$Res>
extends _$MessageStateCopyWithImpl<$Res, _$MessageStateImpl>
implements _$$MessageStateImplCopyWith<$Res> {
__$$MessageStateImplCopyWithImpl(
_$MessageStateImpl _value, $Res Function(_$MessageStateImpl) _then)
: super(_value, _then);
class _$MessageStateCopyWithImpl<$Res> implements $MessageStateCopyWith<$Res> {
_$MessageStateCopyWithImpl(this._self, this._then);
final MessageState _self;
final $Res Function(MessageState) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@ -129,21 +99,21 @@ class __$$MessageStateImplCopyWithImpl<$Res>
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_$MessageStateImpl(
return _then(_self.copyWith(
content: null == content
? _value.content
? _self.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _value.sentTimestamp
? _self.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _value.reconciledTimestamp
? _self.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _value.sendState
? _self.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
));
@ -152,16 +122,15 @@ class __$$MessageStateImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
const _$MessageStateImpl(
class _MessageState with DiagnosticableTreeMixin implements MessageState {
const _MessageState(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required this.content,
required this.sentTimestamp,
required this.reconciledTimestamp,
required this.sendState});
factory _$MessageStateImpl.fromJson(Map<String, dynamic> json) =>
_$$MessageStateImplFromJson(json);
factory _MessageState.fromJson(Map<String, dynamic> json) =>
_$MessageStateFromJson(json);
// Content of the message
@override
@ -177,14 +146,23 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
@override
final MessageSendState? sendState;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$MessageStateCopyWith<_MessageState> get copyWith =>
__$MessageStateCopyWithImpl<_MessageState>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$MessageStateToJson(
this,
);
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'MessageState'))
..add(DiagnosticsProperty('content', content))
@ -197,7 +175,7 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$MessageStateImpl &&
other is _MessageState &&
(identical(other.content, content) || other.content == content) &&
(identical(other.sentTimestamp, sentTimestamp) ||
other.sentTimestamp == sentTimestamp) &&
@ -212,48 +190,65 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
int get hashCode => Object.hash(
runtimeType, content, sentTimestamp, reconciledTimestamp, sendState);
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith =>
__$$MessageStateImplCopyWithImpl<_$MessageStateImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$MessageStateImplToJson(
this,
);
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
}
}
abstract class _MessageState implements MessageState {
const factory _MessageState(
/// @nodoc
abstract mixin class _$MessageStateCopyWith<$Res>
implements $MessageStateCopyWith<$Res> {
factory _$MessageStateCopyWith(
_MessageState value, $Res Function(_MessageState) _then) =
__$MessageStateCopyWithImpl;
@override
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required final proto.Message content,
required final Timestamp sentTimestamp,
required final Timestamp? reconciledTimestamp,
required final MessageSendState? sendState}) = _$MessageStateImpl;
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
factory _MessageState.fromJson(Map<String, dynamic> json) =
_$MessageStateImpl.fromJson;
/// @nodoc
class __$MessageStateCopyWithImpl<$Res>
implements _$MessageStateCopyWith<$Res> {
__$MessageStateCopyWithImpl(this._self, this._then);
// Content of the message
@override
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message get content; // Sent timestamp
@override
Timestamp get sentTimestamp; // Reconciled timestamp
@override
Timestamp? get reconciledTimestamp; // The state of the message
@override
MessageSendState? get sendState;
final _MessageState _self;
final $Res Function(_MessageState) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$Res call({
Object? content = null,
Object? sentTimestamp = null,
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_MessageState(
content: null == content
? _self.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _self.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _self.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _self.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
));
}
}
// dart format on

View file

@ -6,8 +6,8 @@ part of 'message_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_$MessageStateImpl _$$MessageStateImplFromJson(Map<String, dynamic> json) =>
_$MessageStateImpl(
_MessageState _$MessageStateFromJson(Map<String, dynamic> json) =>
_MessageState(
content: messageFromJson(json['content'] as Map<String, dynamic>),
sentTimestamp: Timestamp.fromJson(json['sent_timestamp']),
reconciledTimestamp: json['reconciled_timestamp'] == null
@ -18,7 +18,7 @@ _$MessageStateImpl _$$MessageStateImplFromJson(Map<String, dynamic> json) =>
: MessageSendState.fromJson(json['send_state']),
);
Map<String, dynamic> _$$MessageStateImplToJson(_$MessageStateImpl instance) =>
Map<String, dynamic> _$MessageStateToJson(_MessageState instance) =>
<String, dynamic>{
'content': messageToJson(instance.content),
'sent_timestamp': instance.sentTimestamp.toJson(),

View file

@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'window_state.freezed.dart';
@freezed
class WindowState<T> with _$WindowState<T> {
sealed class WindowState<T> with _$WindowState<T> {
const factory WindowState({
// List of objects in the window
required IList<T> window,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,98 +10,71 @@ part of 'window_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$WindowState<T> {
mixin _$WindowState<T> implements DiagnosticableTreeMixin {
// List of objects in the window
IList<T> get window =>
throw _privateConstructorUsedError; // Total number of objects (windowTail max)
int get length =>
throw _privateConstructorUsedError; // One past the end of the last element
int get windowTail =>
throw _privateConstructorUsedError; // The total number of elements to try to keep in the window
int get windowCount =>
throw _privateConstructorUsedError; // If we should have the tail following the array
bool get follow => throw _privateConstructorUsedError;
IList<T> get window; // Total number of objects (windowTail max)
int get length; // One past the end of the last element
int get windowTail; // The total number of elements to try to keep in the window
int get windowCount; // If we should have the tail following the array
bool get follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$WindowStateCopyWith<T, WindowState<T>> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $WindowStateCopyWith<T, $Res> {
factory $WindowStateCopyWith(
WindowState<T> value, $Res Function(WindowState<T>) then) =
_$WindowStateCopyWithImpl<T, $Res, WindowState<T>>;
@useResult
$Res call(
{IList<T> window,
int length,
int windowTail,
int windowCount,
bool follow});
}
/// @nodoc
class _$WindowStateCopyWithImpl<T, $Res, $Val extends WindowState<T>>
implements $WindowStateCopyWith<T, $Res> {
_$WindowStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$WindowStateCopyWith<T, WindowState<T>> get copyWith =>
_$WindowStateCopyWithImpl<T, WindowState<T>>(
this as WindowState<T>, _$identity);
@override
$Res call({
Object? window = null,
Object? length = null,
Object? windowTail = null,
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_value.copyWith(
window: null == window
? _value.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _value.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _value.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _value.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _value.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
properties
..add(DiagnosticsProperty('type', 'WindowState<$T>'))
..add(DiagnosticsProperty('window', window))
..add(DiagnosticsProperty('length', length))
..add(DiagnosticsProperty('windowTail', windowTail))
..add(DiagnosticsProperty('windowCount', windowCount))
..add(DiagnosticsProperty('follow', follow));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is WindowState<T> &&
const DeepCollectionEquality().equals(other.window, window) &&
(identical(other.length, length) || other.length == length) &&
(identical(other.windowTail, windowTail) ||
other.windowTail == windowTail) &&
(identical(other.windowCount, windowCount) ||
other.windowCount == windowCount) &&
(identical(other.follow, follow) || other.follow == follow));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(window),
length,
windowTail,
windowCount,
follow);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
}
/// @nodoc
abstract class _$$WindowStateImplCopyWith<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
factory _$$WindowStateImplCopyWith(_$WindowStateImpl<T> value,
$Res Function(_$WindowStateImpl<T>) then) =
__$$WindowStateImplCopyWithImpl<T, $Res>;
@override
abstract mixin class $WindowStateCopyWith<T, $Res> {
factory $WindowStateCopyWith(
WindowState<T> value, $Res Function(WindowState<T>) _then) =
_$WindowStateCopyWithImpl;
@useResult
$Res call(
{IList<T> window,
@ -111,12 +85,12 @@ abstract class _$$WindowStateImplCopyWith<T, $Res>
}
/// @nodoc
class __$$WindowStateImplCopyWithImpl<T, $Res>
extends _$WindowStateCopyWithImpl<T, $Res, _$WindowStateImpl<T>>
implements _$$WindowStateImplCopyWith<T, $Res> {
__$$WindowStateImplCopyWithImpl(
_$WindowStateImpl<T> _value, $Res Function(_$WindowStateImpl<T>) _then)
: super(_value, _then);
class _$WindowStateCopyWithImpl<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
_$WindowStateCopyWithImpl(this._self, this._then);
final WindowState<T> _self;
final $Res Function(WindowState<T>) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@ -129,25 +103,25 @@ class __$$WindowStateImplCopyWithImpl<T, $Res>
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_$WindowStateImpl<T>(
return _then(_self.copyWith(
window: null == window
? _value.window
? _self.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _value.length
? _self.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _value.windowTail
? _self.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _value.windowCount
? _self.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _value.follow
? _self.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
));
@ -156,10 +130,8 @@ class __$$WindowStateImplCopyWithImpl<T, $Res>
/// @nodoc
class _$WindowStateImpl<T>
with DiagnosticableTreeMixin
implements _WindowState<T> {
const _$WindowStateImpl(
class _WindowState<T> with DiagnosticableTreeMixin implements WindowState<T> {
const _WindowState(
{required this.window,
required this.length,
required this.windowTail,
@ -182,14 +154,16 @@ class _$WindowStateImpl<T>
@override
final bool follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WindowStateCopyWith<T, _WindowState<T>> get copyWith =>
__$WindowStateCopyWithImpl<T, _WindowState<T>>(this, _$identity);
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'WindowState<$T>'))
..add(DiagnosticsProperty('window', window))
@ -203,7 +177,7 @@ class _$WindowStateImpl<T>
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$WindowStateImpl<T> &&
other is _WindowState<T> &&
const DeepCollectionEquality().equals(other.window, window) &&
(identical(other.length, length) || other.length == length) &&
(identical(other.windowTail, windowTail) ||
@ -222,40 +196,70 @@ class _$WindowStateImpl<T>
windowCount,
follow);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
}
/// @nodoc
abstract mixin class _$WindowStateCopyWith<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
factory _$WindowStateCopyWith(
_WindowState<T> value, $Res Function(_WindowState<T>) _then) =
__$WindowStateCopyWithImpl;
@override
@useResult
$Res call(
{IList<T> window,
int length,
int windowTail,
int windowCount,
bool follow});
}
/// @nodoc
class __$WindowStateCopyWithImpl<T, $Res>
implements _$WindowStateCopyWith<T, $Res> {
__$WindowStateCopyWithImpl(this._self, this._then);
final _WindowState<T> _self;
final $Res Function(_WindowState<T>) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$WindowStateImplCopyWith<T, _$WindowStateImpl<T>> get copyWith =>
__$$WindowStateImplCopyWithImpl<T, _$WindowStateImpl<T>>(
this, _$identity);
$Res call({
Object? window = null,
Object? length = null,
Object? windowTail = null,
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_WindowState<T>(
window: null == window
? _self.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _self.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _self.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _self.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _self.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
abstract class _WindowState<T> implements WindowState<T> {
const factory _WindowState(
{required final IList<T> window,
required final int length,
required final int windowTail,
required final int windowCount,
required final bool follow}) = _$WindowStateImpl<T>;
// List of objects in the window
@override
IList<T> get window; // Total number of objects (windowTail max)
@override
int get length; // One past the end of the last element
@override
int get windowTail; // The total number of elements to try to keep in the window
@override
int get windowCount; // If we should have the tail following the array
@override
bool get follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$WindowStateImplCopyWith<T, _$WindowStateImpl<T>> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on