/
kuklindal
/
RealEstateAnalyzer
Обзор
Документация
Войти
/
kuklindal
/
RealEstateAnalyzer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
mobile/lib/data/models/document_model.dart
69 строк
2 KB
Daniil Kuklin
style: apply dart formatting
06 май 2026, 13:07
06 май 2026, 13:07
98940a5
Код
Авторство
О чём код?
class DocumentModel { final int? id; final String title; final String address; final String cadastralNumber; final double area; final String ownerName; final String createdAt; final bool isSynced; DocumentModel({ this.id, required this.title, required this.address, required this.cadastralNumber, required this.area, required this.ownerName, required this.createdAt, this.isSynced = true, }); Map<String, dynamic> toMap() { return { 'id': id, 'title': title, 'address': address, 'cadastral_number': cadastralNumber, 'area': area, 'owner_name': ownerName, 'created_at': createdAt, 'is_synced': isSynced ? 1 : 0, }; } factory DocumentModel.fromMap(Map<String, dynamic> map) { return DocumentModel( id: map['id'] as int?, title: map['title'] as String, address: map['address'] as String, cadastralNumber: map['cadastral_number'] as String, area: (map['area'] as num).toDouble(), ownerName: map['owner_name'] as String, createdAt: map['created_at'] as String, isSynced: map['is_synced'] == 1, ); } DocumentModel copyWith({ int? id, String? title, String? address, String? cadastralNumber, double? area, String? ownerName, String? createdAt, bool? isSynced, }) { return DocumentModel( id: id ?? this.id, title: title ?? this.title, address: address ?? this.address, cadastralNumber: cadastralNumber ?? this.cadastralNumber, area: area ?? this.area, ownerName: ownerName ?? this.ownerName, createdAt: createdAt ?? this.createdAt, isSynced: isSynced ?? this.isSynced, ); } }