setConfiguration method

  1. @override
Future<Map<String, dynamic>> setConfiguration(
  1. String type,
  2. String newConfig
)
override

Implementation

@override
Future<Map<String, dynamic>> setConfiguration(
    String type, String newConfig) async {
  // if (isRequestPending) {
  //   return {
  //     "isError": true,
  //     "message": "PENDING_PREVIOUS_REQUEST",
  //     "details": "Called setConfiguration($type)"
  //   };
  // }
  try {
    if (initializedCamera.isEmpty) {
      return {"isError": true, "message": "Please Login to Camera!"};
    }
    // isRequestPending = true;

    await methodChannel.invokeMethod('SET_CONFIG', {
      "cameraId": initializedCamera,
      "type": type,
      "newConfig": newConfig,
    });
    // isRequestPending = false;

    return {"isError": false};
  } catch (e) {
    // isRequestPending = false;

    if (e is PlatformException) {
      return {"isError": true, "message": e.message};
    }

    return {"isError": true, "message": "Error: $e"};
  }
}