Skip to content

fix: Resolve all dart analyze errors and warnings#6

Merged
mayankjanmejay merged 1 commit into
mainfrom
claude/fix-api-wrapper-011CV4vowFC73byanSEoLMnG
Nov 13, 2025
Merged

fix: Resolve all dart analyze errors and warnings#6
mayankjanmejay merged 1 commit into
mainfrom
claude/fix-api-wrapper-011CV4vowFC73byanSEoLMnG

Conversation

@mayankjanmejay
Copy link
Copy Markdown
Owner

@mayankjanmejay mayankjanmejay commented Nov 13, 2025

Fixed the following issues reported by dart analyze:

🔴 Errors Fixed:

  • babel_binance_base.dart: Removed dispose() calls for TestnetSpot and TestnetFuturesUsd classes (they don't have dispose methods)

⚠️ Warnings Fixed:

  • binance_base.dart: Removed unused import 'dart:io'
  • rate_limiter.dart: Removed unused field '_orderCountResetTime'
  • token_bucket.dart: Removed unused extension 'clamp' on double
  • websocket_stream.dart: Added getter for '_lastPongReceived' to expose connection health monitoring

Changes:

  • Removed 2 dispose() calls that were causing errors
  • Cleaned up unused imports and declarations
  • Added useful getter lastPongTime for WebSocket health monitoring
  • All code now passes dart analyze without errors

No functionality changes - only code quality improvements.

Summary by CodeRabbit

  • New Features

    • Added lastPongTime property to WebSocket connections, providing access to the timestamp of the last received pong message
  • Breaking Changes

    • Removed the global clamp() extension method previously available on double values; applications relying on this utility require updates
  • Refactor

    • Optimized internal resource cleanup operations and removed unused utility extensions

Fixed the following issues reported by dart analyze:

🔴 Errors Fixed:
- babel_binance_base.dart: Removed dispose() calls for TestnetSpot and TestnetFuturesUsd classes (they don't have dispose methods)

⚠️ Warnings Fixed:
- binance_base.dart: Removed unused import 'dart:io'
- rate_limiter.dart: Removed unused field '_orderCountResetTime'
- token_bucket.dart: Removed unused extension 'clamp' on double
- websocket_stream.dart: Added getter for '_lastPongReceived' to expose connection health monitoring

Changes:
- Removed 2 dispose() calls that were causing errors
- Cleaned up unused imports and declarations
- Added useful getter lastPongTime for WebSocket health monitoring
- All code now passes dart analyze without errors

No functionality changes - only code quality improvements.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Five targeted cleanups across the rate-limiting and websocket modules: unused imports removed, unnecessary dispose calls eliminated, a private timestamp field removed from daily order count reset, a utility extension on double removed, and a new public getter added to expose websocket pong timing information.

Changes

Cohort / File(s) Change Summary
Import and Disposal Cleanup
lib/src/binance_base.dart
Removed unused dart:io import
Import and Disposal Cleanup
lib/src/babel_binance_base.dart
Removed dispose() calls on testnetSpot and testnetFuturesUsd from dispose() method; replaced with comments noting these components lack dispose methods
Rate Limiting Refactoring
lib/src/rate_limiting/rate_limiter.dart
Removed _orderCountResetTime private field and its update logic from _resetDailyOrderCount() method
Rate Limiting Refactoring
lib/src/rate_limiting/token_bucket.dart
Removed global extension on double providing clamp(min, max) method
WebSocket Enhancement
lib/src/websocket/websocket_stream.dart
Added public getter DateTime? get lastPongTime exposing _lastPongReceived field

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Potential attention areas:
    • Verify that no external code or internal usage depends on the removed clamp() extension on double
    • Confirm that removal of _orderCountResetTime field doesn't break any rate-limiting logic relying on order count reset timing
    • Ensure testnetSpot and testnetFuturesUsd components genuinely lack dispose methods and don't require cleanup

Poem

🐰 Out go the imports that weren't needed,
Extensions removed, no longer heeded,
Fields trimmed down, dispose calls freed,
Pong times exposed—connection speed!
Cleaner, leaner code indeed! ✨

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-api-wrapper-011CV4vowFC73byanSEoLMnG

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed01115 and 1016456.

📒 Files selected for processing (5)
  • lib/src/babel_binance_base.dart (1 hunks)
  • lib/src/binance_base.dart (0 hunks)
  • lib/src/rate_limiting/rate_limiter.dart (0 hunks)
  • lib/src/rate_limiting/token_bucket.dart (0 hunks)
  • lib/src/websocket/websocket_stream.dart (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mayankjanmejay mayankjanmejay merged commit 5667268 into main Nov 13, 2025
1 check was pending
@mayankjanmejay mayankjanmejay deleted the claude/fix-api-wrapper-011CV4vowFC73byanSEoLMnG branch November 13, 2025 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants