tiled 0.11.0 copy "tiled: ^0.11.0" to clipboard
tiled: ^0.11.0 copied to clipboard

A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.

Tiled Dart #

Pub cicd Discord

A Dart Tiled library.

Install from Dart Pub Repository #

To include the package as a depencency in your pubspec.yaml, run the following (or add it manually):

dart pub add tiled
copied to clipboard

Usage #

Import the package like this:

    import 'package:tiled/tiled.dart';
copied to clipboard

Load Tmx Files #

Load a TMX file into a string by any means, and then pass the string to TileMapParser.parseXml():

    final String tmxBody = /* ... */;
    final TiledMap mapTmx = TileMapParser.parseTmx(tmxBody);
copied to clipboard

If your tmx file includes a external tsx reference, you have to add a CustomParser

class CustomTsxProvider extends TsxProvider {
  @override
  Parser getSource(String fileName) {
    final xml = File(fileName).readAsStringSync();
    final node = XmlDocument.parse(xml).rootElement;
    return XmlParser(node);
  }
}
copied to clipboard

And use it in the parseTmx method

    final String tmxBody = /* ... */;
    final TiledMap mapTmx = TileMapParser.parseTmx(tmxBody, tsx: CustomTsxProvider());

copied to clipboard

Load Json Files #

Alternatively load a json file.

    final String jsonBody = /* ... */;
    final TiledMap mapTmx = TileMapParser.parseJson(jsonBody);
copied to clipboard

Implementation #

For further information and more usage examples, please take a look at the examples in flame_tiled.

31
likes
120
points
3.45k
downloads

Publisher

verified publisherflame-engine.org

Weekly Downloads

2024.09.10 - 2025.03.25

A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.

Repository (GitHub)
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

archive, collection, meta, xml

More

Packages that depend on tiled