safeStreamReset static method

Future<void> safeStreamReset(
  1. dynamic stream, {
  2. String? context,
})

Safely resets a stream without throwing exceptions

Implementation

static Future<void> safeStreamReset(dynamic stream, {String? context}) async {
  try {
    if (stream != null && stream.reset != null) {
      await stream.reset();
    }
  } catch (e) {
    _log.warning('Error during safe stream reset${context != null ? ' ($context)' : ''}: $e');
  }
}