fromFile static method

Future<TemplateWithSchema> fromFile(
  1. String filePath
)

Loads a template from the file system

Implementation

static Future<TemplateWithSchema> fromFile(String filePath) async {
  try {
    final file = File(filePath);
    if (!await file.exists()) {
      throw Exception('Template file not found: $filePath');
    }

    final content = await file.readAsString(encoding: utf8);
    return _parseRptContent(content);
  } catch (e) {
    throw Exception('Error loading the template from file: $e');
  }
}