parseFile method

Future<void> parseFile(
  1. String path, {
  2. String? nameProperty,
  3. bool verbose = false,
  4. GeoJsonQuery? query,
  5. bool disableStream = false,
})

Parse the data from a file

Implementation

Future<void> parseFile(String path,
    {String? nameProperty,
    bool verbose = false,
    GeoJsonQuery? query,
    bool disableStream = false}) async {
  final file = File(path);
  if (!file.existsSync()) {
    throw FileSystemException("The file ${file.path} does not exist");
  }
  String data;
  try {
    data = await file.readAsString();
  } catch (e) {
    throw FileSystemException("Can not read file $e");
  }
  if (verbose) {
    print("Parsing file ${file.path}");
  }
  await _parse(data,
      nameProperty: nameProperty,
      verbose: verbose,
      query: query,
      disableStream: disableStream);
}