cities_auto function

Future<Cities> cities_auto()

Loads the cities file from the disk and parses it into a safe model.

Implementation

Future<Cities> cities_auto() async {
  final location_of_cities_file_within_this_package = Uri.parse(
    _cities_path_within_package,
  );
  final resolved_location = await Isolate.resolvePackageUri(
    location_of_cities_file_within_this_package,
  );
  if (resolved_location == null) {
    throw Exception(
      _cities_package_name +
          ": Resolving the dataset location within the package by using Isolate.resolvePackageUri failed.",
    );
  } else {
    final file_path = resolved_location.toFilePath();
    final file = File(
      file_path,
    );
    return _cities_from_raw_file(
      file: file,
    );
  }
}