UDocBookmark.fromJson constructor

UDocBookmark.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory UDocBookmark.fromJson(Map<String, Object?> json) => UDocBookmark(
  id: (json["id"] as String?) ?? _newId(),
  pageIndex: (json["page"] as num?)?.toInt() ?? 0,
  blockIndex: (json["block"] as num?)?.toInt() ?? -1,
  progress: (json["progress"] as num?)?.toDouble() ?? -1,
  title: (json["title"] as String?) ?? "",
  note: (json["note"] as String?) ?? "",
  color: Color((json["color"] as num?)?.toInt() ?? 0xFFE53935),
  createdAt: DateTime.tryParse((json["created"] as String?) ?? "") ?? DateTime.now(),
);