parseTmx static method

TiledMap parseTmx(
  1. String xml, {
  2. List<TsxProvider>? tsxList,
})

Parses the provided map xml.

Accepts an optional list of external TsxProviders for external tilesets referenced in the map file.

Implementation

static TiledMap parseTmx(String xml, {List<TsxProvider>? tsxList}) {
  final xmlElement = XmlDocument.parse(xml).rootElement;
  if (xmlElement.name.local != 'map') {
    throw 'XML is not in TMX format';
  }
  final parser = XmlParser(xmlElement);
  return TiledMap.parse(parser, tsxList: tsxList);
}