58 lines
1.2 KiB
Dart
58 lines
1.2 KiB
Dart
import 'package:uuid/uuid.dart';
|
|
|
|
class Category {
|
|
Category({
|
|
String? id,
|
|
required this.name,
|
|
this.serverVersion = 0,
|
|
this.isDeleted = false,
|
|
required this.updatedAt,
|
|
this.isDirty = true,
|
|
this.colorValue,
|
|
this.iconCodePoint,
|
|
}) : id = id ?? Uuid().v4();
|
|
|
|
final String id;
|
|
final String name;
|
|
final int serverVersion;
|
|
final bool isDeleted;
|
|
final DateTime updatedAt;
|
|
final bool isDirty;
|
|
final int? colorValue;
|
|
final int? iconCodePoint;
|
|
|
|
Category copyWith({
|
|
String? id,
|
|
String? name,
|
|
int? serverVersion,
|
|
bool? isDeleted,
|
|
DateTime? updatedAt,
|
|
bool? isDirty,
|
|
int? colorValue,
|
|
int? iconCodePoint,
|
|
}) {
|
|
return Category(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
serverVersion: serverVersion ?? this.serverVersion,
|
|
isDeleted: isDeleted ?? this.isDeleted,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
isDirty: isDirty ?? this.isDirty,
|
|
colorValue: colorValue ?? this.colorValue,
|
|
iconCodePoint: iconCodePoint ?? this.iconCodePoint,
|
|
);
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
|
|
return other is Category && id == other.id;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => id.hashCode;
|
|
}
|