getConfiguration method

  1. @override
Future<Map<String, dynamic>> getConfiguration(
  1. String type
)
override

Implementation

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

    List data = await methodChannel.invokeMethod('GET_CONFIG', {
      "cameraId": initializedCamera,
      "type": type,
    });
    // isRequestPending = false;
    return {"isError": false, "details": data[0]};
  } catch (e) {
    // isRequestPending = false;

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

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