setError method

dynamic setError(
  1. String message, [
  2. String? stackTrace
])

Sets an error message describing the failure to receive a response, if such a failure occurred.

If the request was successful, this should be left null. Additional stackTrace can be added.

Method might throw Exception.

Implementation

setError(String message, [String? stackTrace]) async {
  try {
    final errorDict = {
      "message": message,
      "stack": stackTrace ?? 'N/A',
    };
    final args = {"id": id, "errorDict": errorDict};
    await channel.invokeMethod<void>('setRequestTrackerErrorInfo', args);
    return this;
  } on PlatformException catch (e) {
    throw Exception(e.details);
  }
}