getOrNull method

T? getOrNull()

Unwraps the data, returning null if there's an error.

Safe way to access data that might not exist.

Example:

final session = response.getOrNull();
if (session != null) {
  print('Session: ${session.id}');
}

Implementation

T? getOrNull() => data;