load method

List<AttachRecord> load()

Implementation

List<AttachRecord> load() {
  final file = File(_path);
  if (!file.existsSync()) return [];
  try {
    final decoded = jsonDecode(file.readAsStringSync());
    if (decoded is! List) return [];
    return decoded
        .whereType<Map>()
        .map((m) => AttachRecord.fromJson(m.cast<String, Object?>()))
        .whereType<AttachRecord>()
        .toList();
  } on Object {
    return [];
  }
}