withTimeout method

Future<T> withTimeout(
  1. Duration duration, {
  2. T? fallback,
  3. String? message,
})

Implementation

Future<T> withTimeout(Duration duration, {T? fallback, String? message}) {
  return timeout(
    duration,
    onTimeout: fallback != null
        ? () => fallback
        : () => throw TimeoutException(
            message ?? 'İstek zaman aşımına uğradı (${duration.inSeconds}s)',
          ),
  );
}