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
Motivation & Problem
In
lib/core/database/redis_connection.dart(lines 135–145):Inside the
redispackage, callingclose()on an uninitialized or already-closed connection performs an unguarded null assertion on the internal socket (_socket!.close()), throwingTypeError / Null check operator used on a null valueand logging noisy errors.Proposed Solution
RedisConnection.disconnect(), safely guard connection disposal and handleTypeError / Null check operatorso that disconnects are idempotent and silent.Acceptance Criteria
disconnect()calls are idempotent.