feat(chat): add websocket

This commit is contained in:
mso7nueh
2024-06-24 20:03:54 +03:00
parent eaa9247927
commit 05ccfd289c
17 changed files with 911 additions and 195 deletions

View File

@@ -6,7 +6,11 @@ part 'websocket_info_model.g.dart';
@freezed
class WebsocketInfoModel with _$WebsocketInfoModel {
const factory WebsocketInfoModel() = _WebsocketInfoModel;
const factory WebsocketInfoModel({
required String key,
required String host,
required String port,
}) = _WebsocketInfoModel;
factory WebsocketInfoModel.fromJson(Map<String, Object?> json) => _$WebsocketInfoModelFromJson(json);
}

View File

@@ -20,7 +20,14 @@ WebsocketInfoModel _$WebsocketInfoModelFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$WebsocketInfoModel {
String get key => throw _privateConstructorUsedError;
String get host => throw _privateConstructorUsedError;
String get port => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$WebsocketInfoModelCopyWith<WebsocketInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
@@ -28,6 +35,8 @@ abstract class $WebsocketInfoModelCopyWith<$Res> {
factory $WebsocketInfoModelCopyWith(
WebsocketInfoModel value, $Res Function(WebsocketInfoModel) then) =
_$WebsocketInfoModelCopyWithImpl<$Res, WebsocketInfoModel>;
@useResult
$Res call({String key, String host, String port});
}
/// @nodoc
@@ -39,13 +48,40 @@ class _$WebsocketInfoModelCopyWithImpl<$Res, $Val extends WebsocketInfoModel>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? key = null,
Object? host = null,
Object? port = null,
}) {
return _then(_value.copyWith(
key: null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port: null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$WebsocketInfoModelImplCopyWith<$Res> {
abstract class _$$WebsocketInfoModelImplCopyWith<$Res>
implements $WebsocketInfoModelCopyWith<$Res> {
factory _$$WebsocketInfoModelImplCopyWith(_$WebsocketInfoModelImpl value,
$Res Function(_$WebsocketInfoModelImpl) then) =
__$$WebsocketInfoModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String key, String host, String port});
}
/// @nodoc
@@ -55,30 +91,72 @@ class __$$WebsocketInfoModelImplCopyWithImpl<$Res>
__$$WebsocketInfoModelImplCopyWithImpl(_$WebsocketInfoModelImpl _value,
$Res Function(_$WebsocketInfoModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? key = null,
Object? host = null,
Object? port = null,
}) {
return _then(_$WebsocketInfoModelImpl(
key: null == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as String,
host: null == host
? _value.host
: host // ignore: cast_nullable_to_non_nullable
as String,
port: null == port
? _value.port
: port // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
const _$WebsocketInfoModelImpl();
const _$WebsocketInfoModelImpl(
{required this.key, required this.host, required this.port});
factory _$WebsocketInfoModelImpl.fromJson(Map<String, dynamic> json) =>
_$$WebsocketInfoModelImplFromJson(json);
@override
final String key;
@override
final String host;
@override
final String port;
@override
String toString() {
return 'WebsocketInfoModel()';
return 'WebsocketInfoModel(key: $key, host: $host, port: $port)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$WebsocketInfoModelImpl);
(other.runtimeType == runtimeType &&
other is _$WebsocketInfoModelImpl &&
(identical(other.key, key) || other.key == key) &&
(identical(other.host, host) || other.host == host) &&
(identical(other.port, port) || other.port == port));
}
@JsonKey(ignore: true)
@override
int get hashCode => runtimeType.hashCode;
int get hashCode => Object.hash(runtimeType, key, host, port);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
__$$WebsocketInfoModelImplCopyWithImpl<_$WebsocketInfoModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
@@ -89,8 +167,22 @@ class _$WebsocketInfoModelImpl implements _WebsocketInfoModel {
}
abstract class _WebsocketInfoModel implements WebsocketInfoModel {
const factory _WebsocketInfoModel() = _$WebsocketInfoModelImpl;
const factory _WebsocketInfoModel(
{required final String key,
required final String host,
required final String port}) = _$WebsocketInfoModelImpl;
factory _WebsocketInfoModel.fromJson(Map<String, dynamic> json) =
_$WebsocketInfoModelImpl.fromJson;
@override
String get key;
@override
String get host;
@override
String get port;
@override
@JsonKey(ignore: true)
_$$WebsocketInfoModelImplCopyWith<_$WebsocketInfoModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -8,8 +8,16 @@ part of 'websocket_info_model.dart';
_$WebsocketInfoModelImpl _$$WebsocketInfoModelImplFromJson(
Map<String, dynamic> json) =>
_$WebsocketInfoModelImpl();
_$WebsocketInfoModelImpl(
key: json['key'] as String,
host: json['host'] as String,
port: json['port'] as String,
);
Map<String, dynamic> _$$WebsocketInfoModelImplToJson(
_$WebsocketInfoModelImpl instance) =>
<String, dynamic>{};
<String, dynamic>{
'key': instance.key,
'host': instance.host,
'port': instance.port,
};