configure method

  1. @override
Future<bool?> configure({
  1. required String key,
  2. String? customerCode,
  3. SmKitPoseModelChoice poseModelChoice = SmKitPoseModelChoice.adaptiveChoice,
  4. SMKitLanguage configureLanguage = SMKitLanguage.english,
  5. bool includesHighlights = false,
  6. bool includesObjectDetectionFeedbacks = false,
  7. SMKitModelDownloadPolicy modelDownloadPolicy = SMKitModelDownloadPolicy.waitForRemoteModelsThenFallback,
  8. void onHandle(
    1. SMKitStatus
    )?,
})
override

Implementation

@override
Future<bool?> configure({
  required String key,
  String? customerCode,
  SmKitPoseModelChoice poseModelChoice = SmKitPoseModelChoice.adaptiveChoice,
  SMKitLanguage configureLanguage = SMKitLanguage.english,
  bool includesHighlights = false,
  bool includesObjectDetectionFeedbacks = false,
  SMKitModelDownloadPolicy modelDownloadPolicy =
      SMKitModelDownloadPolicy.waitForRemoteModelsThenFallback,
  void Function(SMKitStatus)? onHandle,
}) async {
  final arg = {
    'apiPublicKey': key,
    if (customerCode != null) 'customerCode': customerCode,
    'poseModelChoice': poseModelChoice.nativeValue,
    'configureLanguage': configureLanguage.name,
    'includesHighlights': includesHighlights,
    if (includesObjectDetectionFeedbacks)
      'includesObjectDetectionFeedbacks': true,
    if (modelDownloadPolicy !=
        SMKitModelDownloadPolicy.waitForRemoteModelsThenFallback)
      'modelDownloadPolicy': modelDownloadPolicy.name,
  };
  bool? res = false;
  try {
    return await methodChannel.invokeMethod<bool?>('configure', arg);
  } on PlatformException catch (e) {
    debugPrint('PlatformException: ${e.code} ${e.message}');
  }
  return res;
}