readFile method
Read a CLDF archive from a file
Implementation
Future<CLDFArchive> readFile(String filePath) async {
_logger.info('Starting CLDF import from file: $filePath');
final file = File(filePath);
if (!await file.exists()) {
_logger.severe('Import failed: File not found at $filePath');
throw Exception('File not found: $filePath');
}
try {
_logger.fine('Reading file bytes from $filePath');
final bytes = await file.readAsBytes();
_logger.fine('File size: ${bytes.length} bytes');
return readBytes(bytes);
} catch (e, stackTrace) {
_logger.severe('Import failed: Error reading file', e, stackTrace);
rethrow;
}
}