load method

  1. @override
List<Record> load(
  1. Directory dir
)
override

Implementation

@override
List<Record> load(Directory dir) {
  if (!dir.existsSync()) {
    throw ArgumentError('The dir $dir not found');
  }
  final files = dir
      .listSync(recursive: false)
      .where((it) => it.path.endsWith('.json'))
      .cast<File>();
  return files.map((it) {
    final json = _decode(it);
    return Record(
      basenameWithoutExtension(it.path),
      json,
    );
  }).toList()
    ..sort((a, b) => a.locale.compareTo(b.locale));
}