Motivation & Problem
In lib/core/database/redis_connection.dart (lines 135–145):
Future<void> disconnect() async {
_isConnected = false;
_command = null;
final c = _conn;
_conn = null;
try {
await c?.close();
} catch (e) {
debugPrint('RedisConnection.disconnect: ');
}
}
Inside the redis package, calling close() on an uninitialized or already-closed connection performs an unguarded null assertion on the internal socket (_socket!.close()), throwing TypeError / Null check operator used on a null value and logging noisy errors.
Proposed Solution
- In RedisConnection.disconnect(), safely guard connection disposal and handle TypeError / Null check operator so that disconnects are idempotent and silent.
- Add unit tests verifying safe and idempotent disconnect calls.
Acceptance Criteria
- Disconnecting an unconnected or failed Redis connection completes cleanly without throwing or logging null check exceptions.
- Multiple consecutive disconnect() calls are idempotent.
- Unit tests pass.
Reactions are currently unavailable
Motivation & Problem
In lib/core/database/redis_connection.dart (lines 135–145):
Inside the redis package, calling close() on an uninitialized or already-closed connection performs an unguarded null assertion on the internal socket (_socket!.close()), throwing TypeError / Null check operator used on a null value and logging noisy errors.
Proposed Solution
Acceptance Criteria