asyncredux-check-internet-mixin
Add the CheckInternet mixin to ensure network connectivity before action execution. Covers automatic error dialogs, combining with NoDialog for custom UI handling, and AbortWhenNoInternet for silent abort.
Best use case
asyncredux-check-internet-mixin is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Add the CheckInternet mixin to ensure network connectivity before action execution. Covers automatic error dialogs, combining with NoDialog for custom UI handling, and AbortWhenNoInternet for silent abort.
Teams using asyncredux-check-internet-mixin should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/asyncredux-check-internet-mixin/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How asyncredux-check-internet-mixin Compares
| Feature / Agent | asyncredux-check-internet-mixin | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Add the CheckInternet mixin to ensure network connectivity before action execution. Covers automatic error dialogs, combining with NoDialog for custom UI handling, and AbortWhenNoInternet for silent abort.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# CheckInternet Mixin
The `CheckInternet` mixin verifies device connectivity before an action executes. If there's no internet connection, the action aborts and displays a dialog with the message: "There is no Internet. Please, verify your connection."
## Basic Usage
```dart
class LoadText extends AppAction with CheckInternet {
Future<AppState?> reduce() async {
var response = await http.get('https://api.example.com/text');
return state.copy(text: response.body);
}
}
```
The mixin works by overriding the `before()` method. If the device lacks connectivity, it throws a `UserException` which triggers the standard error dialog.
## Customizing the Error Message
Override `connectionException()` to return a custom `UserException`:
```dart
class LoadText extends AppAction with CheckInternet {
@override
UserException connectionException(UserException error) {
return UserException('Unable to load data. Check your connection.');
}
Future<AppState?> reduce() async {
var response = await http.get('https://api.example.com/text');
return state.copy(text: response.body);
}
}
```
## NoDialog Modifier
Use `NoDialog` alongside `CheckInternet` to suppress the automatic error dialog. This allows you to handle connectivity failures in your widgets using `isFailed()` and `exceptionFor()`:
```dart
class LoadText extends AppAction with CheckInternet, NoDialog {
Future<AppState?> reduce() async {
var response = await http.get('https://api.example.com/text');
return state.copy(text: response.body);
}
}
```
Then handle the error in your widget:
```dart
Widget build(BuildContext context) {
if (context.isWaiting(LoadText)) {
return CircularProgressIndicator();
}
if (context.isFailed(LoadText)) {
var exception = context.exceptionFor(LoadText);
return Text('Error: ${exception?.message}');
}
return Text(context.state.text);
}
```
## AbortWhenNoInternet
Use `AbortWhenNoInternet` for silent failure when offline. The action aborts without throwing errors or displaying dialogs—as if it had never been dispatched:
```dart
class RefreshData extends AppAction with AbortWhenNoInternet {
Future<AppState?> reduce() async {
var response = await http.get('https://api.example.com/data');
return state.copy(data: response.body);
}
}
```
This is useful for background refreshes or non-critical operations where user notification isn't needed.
## UnlimitedRetryCheckInternet
This mixin combines three capabilities: internet verification, unlimited retry with exponential backoff, and non-reentrant behavior. It's ideal for essential operations like loading startup data:
```dart
class LoadAppStartupData extends AppAction with UnlimitedRetryCheckInternet {
Future<AppState?> reduce() async {
var response = await http.get('https://api.example.com/startup');
return state.copy(startupData: response.body);
}
}
```
Default retry parameters:
- Initial delay: 350ms
- Multiplier: 2
- Maximum delay with internet: 5 seconds
- Maximum delay without internet: 1 second
Track retry attempts via the `attempts` getter and customize logging through `printRetries()`.
## Mixin Compatibility
Important compatibility rules:
- `CheckInternet` and `AbortWhenNoInternet` are **incompatible** with each other
- Neither `CheckInternet` nor `AbortWhenNoInternet` can be combined with `UnlimitedRetryCheckInternet`
- `CheckInternet` works well with `Retry`, `NonReentrant`, `Throttle`, `Debounce`, and optimistic mixins
## Testing Internet Connectivity
Two methods for simulating connectivity in tests:
**Per-action simulation** - Override `internetOnOffSimulation` within specific actions:
```dart
class LoadText extends AppAction with CheckInternet {
@override
bool? get internetOnOffSimulation => false; // Simulate offline
Future<AppState?> reduce() async {
// ...
}
}
```
**Global simulation** - Set `forceInternetOnOffSimulation` on the store:
```dart
var store = Store<AppState>(
initialState: AppState.initialState(),
);
store.forceInternetOnOffSimulation = false; // All actions see no internet
```
## Limitations
These mixins only detect device connectivity status. They cannot verify:
- Internet provider functionality
- Server availability
- API endpoint reachability
For server-specific connectivity checks, implement additional validation in your action's `reduce()` method or `before()` method.
## References
URLs from the documentation:
- https://asyncredux.com/flutter/advanced-actions/internet-mixins
- https://asyncredux.com/flutter/advanced-actions/action-mixins
- https://asyncredux.com/flutter/advanced-actions/aborting-the-dispatch
- https://asyncredux.com/flutter/basics/failed-actions
- https://asyncredux.com/flutter/advanced-actions/errors-thrown-by-actions
- https://asyncredux.com/flutter/advanced-actions/control-mixins
- https://asyncredux.com/flutter/advanced-actions/before-and-after-the-reducer
- https://asyncredux.com/flutter/advanced-actions/redux-action
- https://asyncredux.com/flutter/basics/wait-fail-succeed
- https://asyncredux.com/flutter/testing/mockingRelated Skills
acc-check-leaky-abstractions
Detects leaky abstractions in PHP code. Identifies implementation details exposed in interfaces, concrete returns from abstract methods, framework leakage into domain, and infrastructure concerns in application layer.
acc-check-encapsulation
Analyzes PHP code for encapsulation violations. Detects public mutable state, exposed internals, Tell Don't Ask violations, getter/setter abuse, and information hiding breaches.
acc-check-bounded-contexts
Analyzes bounded context boundaries in DDD projects. Detects cross-context coupling, shared kernel violations, context mapping issues, and ubiquitous language inconsistencies. Generates context map diagrams and boundary recommendations.
a11y-self-check
Proactively validates Claude Code's own generated HTML/JSX/TSX output for accessibility before presenting to users. Use this skill automatically when generating UI code to ensure WCAG 2.1 AA compliance.
asyncredux-wait-fail-succeed
Show loading states and handle action failures in widgets. Covers `isWaiting(ActionType)` for spinners, `isFailed(ActionType)` for error states, `exceptionFor(ActionType)` for error messages, and `clearExceptionFor()` to reset failure states.
asyncredux-wait-condition
Use `waitCondition()` inside actions to pause execution until state meets criteria. Covers waiting for price thresholds, coordinating between actions, and implementing conditional workflows.
asyncredux-user-exceptions
Handle user-facing errors with UserException. Covers throwing UserException from actions, setting up UserExceptionDialog, customizing error dialogs with `onShowUserExceptionDialog`, and using UserExceptionAction for non-interrupting error display.
asyncredux-sync-actions
Creates AsyncRedux (Flutter) synchronous actions that update state immediately by implementing reduce() to return a new state.
asyncredux-streams-timers
Manage Streams and Timers with AsyncRedux. Covers creating actions to start/stop streams, storing stream subscriptions in store props, dispatching actions from stream callbacks, and proper cleanup with disposeProps().
asyncredux-state-access
Access store state in widgets using `context.state`, `context.select()`, and `context.read()`. Covers when to use each method, setting up BuildContext extensions, and optimizing widget rebuilds with selective state access.
asyncredux-setup
Initialize, setup and configure AsyncRedux in a Flutter app. Use it whenever starting a new AsyncRedux project, or when the user requests.
asyncredux-selectors
Create and cache selectors for efficient state access. Covers writing selector functions, caching with `cache1` and `cache2`, the reselect pattern, and avoiding repeated computations in widgets.