platformCapFromCap static method

  1. @visibleForTesting
PlatformCap platformCapFromCap(
  1. Cap cap
)

Convert Cap from platform interface to PlatformCap pigeon.

Implementation

@visibleForTesting
static PlatformCap platformCapFromCap(Cap cap) {
  switch (cap.type) {
    case CapType.butt:
      return PlatformCap(type: PlatformCapType.buttCap);
    case CapType.square:
      return PlatformCap(type: PlatformCapType.squareCap);
    case CapType.round:
      return PlatformCap(type: PlatformCapType.roundCap);
    case CapType.custom:
      cap as CustomCap;
      return PlatformCap(
        type: PlatformCapType.customCap,
        bitmapDescriptor: platformBitmapFromBitmapDescriptor(
          cap.bitmapDescriptor,
        ),
        refWidth: cap.refWidth,
      );
  }
}