getLayer<T extends Layer> method

T? getLayer<T extends Layer>(
  1. String name
)

Returns a layer of type T with given name from all the layers of this map. If no such layer is found, null is returned.

Implementation

T? getLayer<T extends Layer>(String name) {
  try {
    // layerByName will searches recursively starting with tiled.dart v0.8.5
    return map.layerByName(name) as T;
  } on ArgumentError {
    return null;
  }
}