tileByPhrase method

Tile? tileByPhrase(
  1. String tilePhrase
)

Implementation

Tile? tileByPhrase(String tilePhrase) {
  final split = tilePhrase.split('|');
  if (split.length != 2) {
    throw ArgumentError(
      '$tilePhrase not in the format of "TilesetName|LocalTileID"',
    );
  }

  final tilesetName = split.first;
  final tileId = int.tryParse(split.last);
  if (tileId == null) {
    throw ArgumentError('Local tile ID ${split.last} is not an integer.');
  }

  return tileByLocalId(tilesetName, tileId);
}