createFromFile static method
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
///
/// 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.
static Future<Mapfile> createFromFile({required String filename, String? preferredLanguage, ReadbufferSource? source}) async {
Mapfile mapFile = Mapfile._(preferredLanguage);
await mapFile._init(source ?? createReadbufferSource(filename));
return mapFile;
}