CallOutcome<T> constructor

CallOutcome<T>({
  1. T? data,
  2. Exception? exception,
})

Constructor of the class which accepts two arguments data and exception Please it is compulsory to provide at least one of the two argument. Else an assertion is made resulting in compilation error.

Implementation

CallOutcome({this.data, this.exception})
    :

      /// Checking if both the member fields are not initialised with null
      assert(
        data != null || exception != null,
        "Both data and exception can't be empty",
      );