Files
sendico/frontend/pshared/lib/models/storable.dart
2025-11-13 15:06:15 +03:00

31 lines
650 B
Dart

import 'package:pshared/config/constants.dart';
abstract class Storable {
String get id;
DateTime get createdAt;
DateTime get updatedAt;
}
class _StorableImp implements Storable {
@override
final String id;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
const _StorableImp({
required this.id,
required this.createdAt,
required this.updatedAt,
});
}
Storable newStorable({String? id, DateTime? createdAt, DateTime? updatedAt}) => _StorableImp(
id: id ?? Constants.nilObjectRef,
createdAt: createdAt ?? DateTime.now().toUtc(),
updatedAt: updatedAt ?? DateTime.now().toUtc(),
);