Skip to content

Minor cleanup/refactor of some logic#118

Open
LahaLuhem wants to merge 2 commits intoOutdatedGuy:mainfrom
LahaLuhem:main
Open

Minor cleanup/refactor of some logic#118
LahaLuhem wants to merge 2 commits intoOutdatedGuy:mainfrom
LahaLuhem:main

Conversation

@LahaLuhem
Copy link
Copy Markdown

@LahaLuhem LahaLuhem commented Jan 21, 2026

I made some improvements:

  1. Simplified hasInternetAccess logic
    • Split into two separate methods _hasInternetAccessStrict and _hasInternetAccessNonStrict
    • Removed complex completer logic and race conditions
    • Used Future.wait for strict mode and sequential checking for non-strict mode
  2. Cleaned up _maybeEmitStatusUpdate
    • Moved early return to the top for better readability
    • Removed duplicate listener checks
    • Made the control flow more linear
  3. Simplified _handleStatusChangeCancel
    • Removed unnecessary then callback for subscription cancellation
    • Made the method more straightforward
  4. Improved _checkReachabilityFor: use null assertion operator for cleaner code
  5. Better error handling in _hasInternetAccessNonStrict: added try-catch to handle individual endpoint failures gracefully

I did this in the context to be better be able to support the new feature request in #71

Copy link
Copy Markdown
Owner

@OutdatedGuy OutdatedGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of unnecessary formatting changes. Please revert them first.

@LahaLuhem LahaLuhem force-pushed the main branch 2 times, most recently from 618624f to 14eab66 Compare February 3, 2026 16:05
@LahaLuhem
Copy link
Copy Markdown
Author

You have not defined any kind of formatting guidelines. The code is not even formatted, as these kinds of changes would appear if you'd just run dart format ..
Nevertheless I will try to undo those kinds of changes. But please consider adding some more rules to the analysis_options.yml

@LahaLuhem
Copy link
Copy Markdown
Author

@OutdatedGuy I have reverted most of the formatting

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