createFromFile static method

Future<Mapfile> createFromFile({
  1. required String filename,
  2. String? preferredLanguage,
  3. ReadbufferSource? source,
})

Creates a Mapfile instance from a file path.

This is the standard way to open a .map file from the file system. filename is the path to the .map file. preferredLanguage can be used to select a specific language for labels. source is an optional override for the read buffer source, mainly for testing.

Implementation

static Future<Mapfile> createFromFile({required String filename, String? preferredLanguage, ReadbufferSource? source}) async {
  Mapfile mapFile = Mapfile._(preferredLanguage);
  await mapFile._init(source ?? createReadbufferSource(filename));
  return mapFile;
}