all method

  1. @override
Future<List<Lead>> all()
override

Implementation

@override
Future<List<Lead>> all() async {
  final file = File(path);
  if (!file.existsSync()) return const [];
  final lines = await file.readAsLines();
  return lines
      .where((l) => l.trim().isNotEmpty)
      .map((l) => Lead.fromJson(jsonDecode(l) as Map<String, dynamic>))
      .toList();
}