parseFile method

  1. @override
Map<String, dynamic> parseFile(
  1. String path
)
override

Optionally parses configuration directly from a file located at path.

By default, this method throws a ParserException to indicate that file-based parsing is not supported.
Implementations should override this if file parsing is required.

Example:

final config = parser.parseFile('config.json');
print(config['port']); // e.g. 8080

Implementation

@override
Map<String, dynamic> parseFile(String path) {
  try {
    return super.parseFile(path);
  } catch (e) {
    if (e is ParserException) rethrow;
    throw ParserException('Failed to parse ENV file $path: $e');
  }
}