getCameraPositionList method

  1. @override
Future<List<CameraPosition>?> getCameraPositionList()
override

Implementation

@override
Future<List<CameraPosition>?> getCameraPositionList() async {
  List<Map<dynamic, dynamic>>? argumentList =
      await methodChannel.invokeListMethod(
    SeeSoPluginMethod.GET_CAMERA_POSITION_LIST.name,
  );

  if (argumentList != null) {
    List<CameraPosition> cameraPositions = [];

    for (var arguments in argumentList) {
      String modelName =
          arguments[SeeSoPluginArgumentKey.MODEL_NAME.name] as String;
      double screenWidth =
          arguments[SeeSoPluginArgumentKey.SCREEN_WIDTH.name] as double;
      double screenHeight =
          arguments[SeeSoPluginArgumentKey.SCREEN_HEIGHT.name] as double;
      double screenOriginX =
          arguments[SeeSoPluginArgumentKey.SCREEN_ORIGIN_X.name] as double;
      double screenOriginY =
          arguments[SeeSoPluginArgumentKey.SCREEN_ORIGIN_Y.name] as double;
      bool cameraOnLongerAxis =
          arguments[SeeSoPluginArgumentKey.CAMERA_ON_LONGER_AXIS.name]
              as bool;

      CameraPosition cameraPosition = CameraPosition(
        modelName: modelName,
        screenWidth: screenWidth,
        screenHeight: screenHeight,
        screenOriginX: screenOriginX,
        screenOriginY: screenOriginY,
        cameraOnLongerAxis: cameraOnLongerAxis,
      );

      cameraPositions.add(cameraPosition);
    }

    return cameraPositions;
  }

  return null;
}