/
siblun
/
ReadFlow
Обзор
Документация
Войти
/
siblun
/
ReadFlow
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
lib/data/datasources/note_entity.dart
48 строк
970 B
siblun
Refactoring
04 май 2026, 16:24
04 май 2026, 16:24
a6f9f35
Код
Авторство
О чём код?
import 'package:isar_community/isar.dart'; import '../../domain/models/note_model.dart'; part 'note_entity.g.dart'; @collection class NoteEntity { Id id = Isar.autoIncrement; @Index() String uuid = ''; @Index() String bookUuid = ''; @Index() String? sessionUuid; String text = ''; String? location; DateTime createdAt = DateTime.now(); bool isQuote = false; Note toDomain(){ return Note( id: uuid, bookId: bookUuid, sessionId: sessionUuid, text: text, location: location, createdAt: createdAt, isQuote: isQuote, ); } NoteEntity fromDomain(Note note, {Id? isarId}) { return NoteEntity() ..id = isarId ?? Isar.autoIncrement ..uuid = note.id ..bookUuid = note.bookId ..sessionUuid = note.sessionId ..text = note.text ..location = note.location ..createdAt = note.createdAt ..isQuote = note.isQuote; } }