build method

Implementation

Future<TiledWorldData> build() async {
  try {
    _tiledMap = await _reader.readMap();
    _tileWidthOrigin = _tiledMap?.tileWidth?.toDouble() ?? 0.0;
    _tileHeightOrigin = _tiledMap?.tileHeight?.toDouble() ?? 0.0;
    _tileWidth = forceTileSize?.x ?? _tileWidthOrigin;
    _tileHeight = forceTileSize?.y ?? _tileHeightOrigin;
    await _load(_tiledMap!);
  } catch (e) {
    onError?.call(e);
    // ignore: avoid_print
    print('(TiledWorldMap) Error: $e');
  }

  return Future.value(
    TiledWorldData(
      map: WorldMap(
        _tiles,
        tileSizeToUpdate: tileSizeToUpdate,
      ),
      components: _components,
    ),
  );
}