getLayerBounds method

List<double>? getLayerBounds(
  1. String layerName
)

Implementation

List<double>? getLayerBounds(String layerName) {
  if (dotLottiePlayer != null && !isDisposed) {
    try {
      final player = dotLottiePlayer as JSObject;
      final method = player['getLayerBoundingBox'.toJS] as JSFunction?;
      if (method != null) {
        final result = method.callAsFunction(player, layerName.toJS);
        if (result != null) {
          final array = result as JSArray;
          final bounds = <double>[];
          final length = (array.length as JSNumber).toDartInt;
          for (var i = 0; i < length; i++) {
            bounds.add((array[i] as JSNumber).toDartDouble);
          }
          return bounds;
        }
      }
    } catch (e) {}
  }
  return null;
}