Приложение на флаторе, настройки
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'user.dart';
|
||||
import 'message.dart';
|
||||
|
||||
part 'chat.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class Chat with _$Chat {
|
||||
const factory Chat({
|
||||
required String id,
|
||||
required String type,
|
||||
required String title,
|
||||
String? avatarUrl,
|
||||
List<User>? participants,
|
||||
@Default(null) Message? lastMessage,
|
||||
DateTime? lastMessageTime,
|
||||
@Default(0) int unreadCount,
|
||||
@Default(false) bool isMuted,
|
||||
@Default(false) bool isPinned,
|
||||
}) = _Chat;
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'chat.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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 _$Chat {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get type => throw _privateConstructorUsedError;
|
||||
String get title => throw _privateConstructorUsedError;
|
||||
String? get avatarUrl => throw _privateConstructorUsedError;
|
||||
List<User>? get participants => throw _privateConstructorUsedError;
|
||||
Message? get lastMessage => throw _privateConstructorUsedError;
|
||||
DateTime? get lastMessageTime => throw _privateConstructorUsedError;
|
||||
int get unreadCount => throw _privateConstructorUsedError;
|
||||
bool get isMuted => throw _privateConstructorUsedError;
|
||||
bool get isPinned => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$ChatCopyWith<Chat> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ChatCopyWith<$Res> {
|
||||
factory $ChatCopyWith(Chat value, $Res Function(Chat) then) =
|
||||
_$ChatCopyWithImpl<$Res, Chat>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String type,
|
||||
String title,
|
||||
String? avatarUrl,
|
||||
List<User>? participants,
|
||||
Message? lastMessage,
|
||||
DateTime? lastMessageTime,
|
||||
int unreadCount,
|
||||
bool isMuted,
|
||||
bool isPinned});
|
||||
|
||||
$MessageCopyWith<$Res>? get lastMessage;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ChatCopyWithImpl<$Res, $Val extends Chat>
|
||||
implements $ChatCopyWith<$Res> {
|
||||
_$ChatCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? type = null,
|
||||
Object? title = null,
|
||||
Object? avatarUrl = freezed,
|
||||
Object? participants = freezed,
|
||||
Object? lastMessage = freezed,
|
||||
Object? lastMessageTime = freezed,
|
||||
Object? unreadCount = null,
|
||||
Object? isMuted = null,
|
||||
Object? isPinned = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
avatarUrl: freezed == avatarUrl
|
||||
? _value.avatarUrl
|
||||
: avatarUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
participants: freezed == participants
|
||||
? _value.participants
|
||||
: participants // ignore: cast_nullable_to_non_nullable
|
||||
as List<User>?,
|
||||
lastMessage: freezed == lastMessage
|
||||
? _value.lastMessage
|
||||
: lastMessage // ignore: cast_nullable_to_non_nullable
|
||||
as Message?,
|
||||
lastMessageTime: freezed == lastMessageTime
|
||||
? _value.lastMessageTime
|
||||
: lastMessageTime // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
unreadCount: null == unreadCount
|
||||
? _value.unreadCount
|
||||
: unreadCount // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
isMuted: null == isMuted
|
||||
? _value.isMuted
|
||||
: isMuted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isPinned: null == isPinned
|
||||
? _value.isPinned
|
||||
: isPinned // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$MessageCopyWith<$Res>? get lastMessage {
|
||||
if (_value.lastMessage == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $MessageCopyWith<$Res>(_value.lastMessage!, (value) {
|
||||
return _then(_value.copyWith(lastMessage: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ChatImplCopyWith<$Res> implements $ChatCopyWith<$Res> {
|
||||
factory _$$ChatImplCopyWith(
|
||||
_$ChatImpl value, $Res Function(_$ChatImpl) then) =
|
||||
__$$ChatImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String type,
|
||||
String title,
|
||||
String? avatarUrl,
|
||||
List<User>? participants,
|
||||
Message? lastMessage,
|
||||
DateTime? lastMessageTime,
|
||||
int unreadCount,
|
||||
bool isMuted,
|
||||
bool isPinned});
|
||||
|
||||
@override
|
||||
$MessageCopyWith<$Res>? get lastMessage;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ChatImplCopyWithImpl<$Res>
|
||||
extends _$ChatCopyWithImpl<$Res, _$ChatImpl>
|
||||
implements _$$ChatImplCopyWith<$Res> {
|
||||
__$$ChatImplCopyWithImpl(_$ChatImpl _value, $Res Function(_$ChatImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? type = null,
|
||||
Object? title = null,
|
||||
Object? avatarUrl = freezed,
|
||||
Object? participants = freezed,
|
||||
Object? lastMessage = freezed,
|
||||
Object? lastMessageTime = freezed,
|
||||
Object? unreadCount = null,
|
||||
Object? isMuted = null,
|
||||
Object? isPinned = null,
|
||||
}) {
|
||||
return _then(_$ChatImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
title: null == title
|
||||
? _value.title
|
||||
: title // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
avatarUrl: freezed == avatarUrl
|
||||
? _value.avatarUrl
|
||||
: avatarUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
participants: freezed == participants
|
||||
? _value._participants
|
||||
: participants // ignore: cast_nullable_to_non_nullable
|
||||
as List<User>?,
|
||||
lastMessage: freezed == lastMessage
|
||||
? _value.lastMessage
|
||||
: lastMessage // ignore: cast_nullable_to_non_nullable
|
||||
as Message?,
|
||||
lastMessageTime: freezed == lastMessageTime
|
||||
? _value.lastMessageTime
|
||||
: lastMessageTime // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
unreadCount: null == unreadCount
|
||||
? _value.unreadCount
|
||||
: unreadCount // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
isMuted: null == isMuted
|
||||
? _value.isMuted
|
||||
: isMuted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
isPinned: null == isPinned
|
||||
? _value.isPinned
|
||||
: isPinned // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ChatImpl implements _Chat {
|
||||
const _$ChatImpl(
|
||||
{required this.id,
|
||||
required this.type,
|
||||
required this.title,
|
||||
this.avatarUrl,
|
||||
final List<User>? participants,
|
||||
this.lastMessage = null,
|
||||
this.lastMessageTime,
|
||||
this.unreadCount = 0,
|
||||
this.isMuted = false,
|
||||
this.isPinned = false})
|
||||
: _participants = participants;
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String type;
|
||||
@override
|
||||
final String title;
|
||||
@override
|
||||
final String? avatarUrl;
|
||||
final List<User>? _participants;
|
||||
@override
|
||||
List<User>? get participants {
|
||||
final value = _participants;
|
||||
if (value == null) return null;
|
||||
if (_participants is EqualUnmodifiableListView) return _participants;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final Message? lastMessage;
|
||||
@override
|
||||
final DateTime? lastMessageTime;
|
||||
@override
|
||||
@JsonKey()
|
||||
final int unreadCount;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isMuted;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isPinned;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Chat(id: $id, type: $type, title: $title, avatarUrl: $avatarUrl, participants: $participants, lastMessage: $lastMessage, lastMessageTime: $lastMessageTime, unreadCount: $unreadCount, isMuted: $isMuted, isPinned: $isPinned)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ChatImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.title, title) || other.title == title) &&
|
||||
(identical(other.avatarUrl, avatarUrl) ||
|
||||
other.avatarUrl == avatarUrl) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._participants, _participants) &&
|
||||
(identical(other.lastMessage, lastMessage) ||
|
||||
other.lastMessage == lastMessage) &&
|
||||
(identical(other.lastMessageTime, lastMessageTime) ||
|
||||
other.lastMessageTime == lastMessageTime) &&
|
||||
(identical(other.unreadCount, unreadCount) ||
|
||||
other.unreadCount == unreadCount) &&
|
||||
(identical(other.isMuted, isMuted) || other.isMuted == isMuted) &&
|
||||
(identical(other.isPinned, isPinned) ||
|
||||
other.isPinned == isPinned));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
type,
|
||||
title,
|
||||
avatarUrl,
|
||||
const DeepCollectionEquality().hash(_participants),
|
||||
lastMessage,
|
||||
lastMessageTime,
|
||||
unreadCount,
|
||||
isMuted,
|
||||
isPinned);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ChatImplCopyWith<_$ChatImpl> get copyWith =>
|
||||
__$$ChatImplCopyWithImpl<_$ChatImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _Chat implements Chat {
|
||||
const factory _Chat(
|
||||
{required final String id,
|
||||
required final String type,
|
||||
required final String title,
|
||||
final String? avatarUrl,
|
||||
final List<User>? participants,
|
||||
final Message? lastMessage,
|
||||
final DateTime? lastMessageTime,
|
||||
final int unreadCount,
|
||||
final bool isMuted,
|
||||
final bool isPinned}) = _$ChatImpl;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get type;
|
||||
@override
|
||||
String get title;
|
||||
@override
|
||||
String? get avatarUrl;
|
||||
@override
|
||||
List<User>? get participants;
|
||||
@override
|
||||
Message? get lastMessage;
|
||||
@override
|
||||
DateTime? get lastMessageTime;
|
||||
@override
|
||||
int get unreadCount;
|
||||
@override
|
||||
bool get isMuted;
|
||||
@override
|
||||
bool get isPinned;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$ChatImplCopyWith<_$ChatImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'message.freezed.dart';
|
||||
// part 'message.g.dart';
|
||||
|
||||
@freezed
|
||||
class Message with _$Message {
|
||||
const factory Message({
|
||||
required String id,
|
||||
required String chatId,
|
||||
required String senderId,
|
||||
required String content,
|
||||
required String messageType, // 'text', 'image', 'video', 'audio', 'file'
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
bool? isRead,
|
||||
Map<String, dynamic>? media,
|
||||
}) = _Message;
|
||||
|
||||
// factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'message.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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 _$Message {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get chatId => throw _privateConstructorUsedError;
|
||||
String get senderId => throw _privateConstructorUsedError;
|
||||
String get content => throw _privateConstructorUsedError;
|
||||
String get messageType =>
|
||||
throw _privateConstructorUsedError; // 'text', 'image', 'video', 'audio', 'file'
|
||||
DateTime? get createdAt => throw _privateConstructorUsedError;
|
||||
DateTime? get updatedAt => throw _privateConstructorUsedError;
|
||||
bool? get isRead => throw _privateConstructorUsedError;
|
||||
Map<String, dynamic>? get media => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$MessageCopyWith<Message> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MessageCopyWith<$Res> {
|
||||
factory $MessageCopyWith(Message value, $Res Function(Message) then) =
|
||||
_$MessageCopyWithImpl<$Res, Message>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String chatId,
|
||||
String senderId,
|
||||
String content,
|
||||
String messageType,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
bool? isRead,
|
||||
Map<String, dynamic>? media});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MessageCopyWithImpl<$Res, $Val extends Message>
|
||||
implements $MessageCopyWith<$Res> {
|
||||
_$MessageCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? chatId = null,
|
||||
Object? senderId = null,
|
||||
Object? content = null,
|
||||
Object? messageType = null,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
Object? isRead = freezed,
|
||||
Object? media = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
chatId: null == chatId
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
senderId: null == senderId
|
||||
? _value.senderId
|
||||
: senderId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
content: null == content
|
||||
? _value.content
|
||||
: content // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
messageType: null == messageType
|
||||
? _value.messageType
|
||||
: messageType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
isRead: freezed == isRead
|
||||
? _value.isRead
|
||||
: isRead // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
media: freezed == media
|
||||
? _value.media
|
||||
: media // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MessageImplCopyWith<$Res> implements $MessageCopyWith<$Res> {
|
||||
factory _$$MessageImplCopyWith(
|
||||
_$MessageImpl value, $Res Function(_$MessageImpl) then) =
|
||||
__$$MessageImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String chatId,
|
||||
String senderId,
|
||||
String content,
|
||||
String messageType,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
bool? isRead,
|
||||
Map<String, dynamic>? media});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MessageImplCopyWithImpl<$Res>
|
||||
extends _$MessageCopyWithImpl<$Res, _$MessageImpl>
|
||||
implements _$$MessageImplCopyWith<$Res> {
|
||||
__$$MessageImplCopyWithImpl(
|
||||
_$MessageImpl _value, $Res Function(_$MessageImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? chatId = null,
|
||||
Object? senderId = null,
|
||||
Object? content = null,
|
||||
Object? messageType = null,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
Object? isRead = freezed,
|
||||
Object? media = freezed,
|
||||
}) {
|
||||
return _then(_$MessageImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
chatId: null == chatId
|
||||
? _value.chatId
|
||||
: chatId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
senderId: null == senderId
|
||||
? _value.senderId
|
||||
: senderId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
content: null == content
|
||||
? _value.content
|
||||
: content // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
messageType: null == messageType
|
||||
? _value.messageType
|
||||
: messageType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
isRead: freezed == isRead
|
||||
? _value.isRead
|
||||
: isRead // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
media: freezed == media
|
||||
? _value._media
|
||||
: media // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, dynamic>?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MessageImpl implements _Message {
|
||||
const _$MessageImpl(
|
||||
{required this.id,
|
||||
required this.chatId,
|
||||
required this.senderId,
|
||||
required this.content,
|
||||
required this.messageType,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.isRead,
|
||||
final Map<String, dynamic>? media})
|
||||
: _media = media;
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String chatId;
|
||||
@override
|
||||
final String senderId;
|
||||
@override
|
||||
final String content;
|
||||
@override
|
||||
final String messageType;
|
||||
// 'text', 'image', 'video', 'audio', 'file'
|
||||
@override
|
||||
final DateTime? createdAt;
|
||||
@override
|
||||
final DateTime? updatedAt;
|
||||
@override
|
||||
final bool? isRead;
|
||||
final Map<String, dynamic>? _media;
|
||||
@override
|
||||
Map<String, dynamic>? get media {
|
||||
final value = _media;
|
||||
if (value == null) return null;
|
||||
if (_media is EqualUnmodifiableMapView) return _media;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Message(id: $id, chatId: $chatId, senderId: $senderId, content: $content, messageType: $messageType, createdAt: $createdAt, updatedAt: $updatedAt, isRead: $isRead, media: $media)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MessageImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.chatId, chatId) || other.chatId == chatId) &&
|
||||
(identical(other.senderId, senderId) ||
|
||||
other.senderId == senderId) &&
|
||||
(identical(other.content, content) || other.content == content) &&
|
||||
(identical(other.messageType, messageType) ||
|
||||
other.messageType == messageType) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt) &&
|
||||
(identical(other.isRead, isRead) || other.isRead == isRead) &&
|
||||
const DeepCollectionEquality().equals(other._media, _media));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
chatId,
|
||||
senderId,
|
||||
content,
|
||||
messageType,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
isRead,
|
||||
const DeepCollectionEquality().hash(_media));
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MessageImplCopyWith<_$MessageImpl> get copyWith =>
|
||||
__$$MessageImplCopyWithImpl<_$MessageImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _Message implements Message {
|
||||
const factory _Message(
|
||||
{required final String id,
|
||||
required final String chatId,
|
||||
required final String senderId,
|
||||
required final String content,
|
||||
required final String messageType,
|
||||
final DateTime? createdAt,
|
||||
final DateTime? updatedAt,
|
||||
final bool? isRead,
|
||||
final Map<String, dynamic>? media}) = _$MessageImpl;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get chatId;
|
||||
@override
|
||||
String get senderId;
|
||||
@override
|
||||
String get content;
|
||||
@override
|
||||
String get messageType;
|
||||
@override // 'text', 'image', 'video', 'audio', 'file'
|
||||
DateTime? get createdAt;
|
||||
@override
|
||||
DateTime? get updatedAt;
|
||||
@override
|
||||
bool? get isRead;
|
||||
@override
|
||||
Map<String, dynamic>? get media;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$MessageImplCopyWith<_$MessageImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'user.freezed.dart';
|
||||
// part 'user.g.dart';
|
||||
|
||||
@freezed
|
||||
class User with _$User {
|
||||
const factory User({
|
||||
required String id,
|
||||
required String name,
|
||||
String? avatarUrl,
|
||||
String? role, // 'admin', 'member'
|
||||
bool? isOnline,
|
||||
DateTime? lastSeen,
|
||||
}) = _User;
|
||||
|
||||
// factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
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 _$User {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String? get avatarUrl => throw _privateConstructorUsedError;
|
||||
String? get role => throw _privateConstructorUsedError; // 'admin', 'member'
|
||||
bool? get isOnline => throw _privateConstructorUsedError;
|
||||
DateTime? get lastSeen => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserCopyWith<$Res> {
|
||||
factory $UserCopyWith(User value, $Res Function(User) then) =
|
||||
_$UserCopyWithImpl<$Res, User>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String name,
|
||||
String? avatarUrl,
|
||||
String? role,
|
||||
bool? isOnline,
|
||||
DateTime? lastSeen});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserCopyWithImpl<$Res, $Val extends User>
|
||||
implements $UserCopyWith<$Res> {
|
||||
_$UserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? avatarUrl = freezed,
|
||||
Object? role = freezed,
|
||||
Object? isOnline = freezed,
|
||||
Object? lastSeen = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
avatarUrl: freezed == avatarUrl
|
||||
? _value.avatarUrl
|
||||
: avatarUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
isOnline: freezed == isOnline
|
||||
? _value.isOnline
|
||||
: isOnline // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
lastSeen: freezed == lastSeen
|
||||
? _value.lastSeen
|
||||
: lastSeen // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
|
||||
factory _$$UserImplCopyWith(
|
||||
_$UserImpl value, $Res Function(_$UserImpl) then) =
|
||||
__$$UserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String name,
|
||||
String? avatarUrl,
|
||||
String? role,
|
||||
bool? isOnline,
|
||||
DateTime? lastSeen});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserImplCopyWithImpl<$Res>
|
||||
extends _$UserCopyWithImpl<$Res, _$UserImpl>
|
||||
implements _$$UserImplCopyWith<$Res> {
|
||||
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? avatarUrl = freezed,
|
||||
Object? role = freezed,
|
||||
Object? isOnline = freezed,
|
||||
Object? lastSeen = freezed,
|
||||
}) {
|
||||
return _then(_$UserImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
avatarUrl: freezed == avatarUrl
|
||||
? _value.avatarUrl
|
||||
: avatarUrl // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
role: freezed == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
isOnline: freezed == isOnline
|
||||
? _value.isOnline
|
||||
: isOnline // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
lastSeen: freezed == lastSeen
|
||||
? _value.lastSeen
|
||||
: lastSeen // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UserImpl implements _User {
|
||||
const _$UserImpl(
|
||||
{required this.id,
|
||||
required this.name,
|
||||
this.avatarUrl,
|
||||
this.role,
|
||||
this.isOnline,
|
||||
this.lastSeen});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String? avatarUrl;
|
||||
@override
|
||||
final String? role;
|
||||
// 'admin', 'member'
|
||||
@override
|
||||
final bool? isOnline;
|
||||
@override
|
||||
final DateTime? lastSeen;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User(id: $id, name: $name, avatarUrl: $avatarUrl, role: $role, isOnline: $isOnline, lastSeen: $lastSeen)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.avatarUrl, avatarUrl) ||
|
||||
other.avatarUrl == avatarUrl) &&
|
||||
(identical(other.role, role) || other.role == role) &&
|
||||
(identical(other.isOnline, isOnline) ||
|
||||
other.isOnline == isOnline) &&
|
||||
(identical(other.lastSeen, lastSeen) ||
|
||||
other.lastSeen == lastSeen));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, name, avatarUrl, role, isOnline, lastSeen);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _User implements User {
|
||||
const factory _User(
|
||||
{required final String id,
|
||||
required final String name,
|
||||
final String? avatarUrl,
|
||||
final String? role,
|
||||
final bool? isOnline,
|
||||
final DateTime? lastSeen}) = _$UserImpl;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String? get avatarUrl;
|
||||
@override
|
||||
String? get role;
|
||||
@override // 'admin', 'member'
|
||||
bool? get isOnline;
|
||||
@override
|
||||
DateTime? get lastSeen;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user