Skip to content
pubscout

load_switch

3.2.0, released 8 weeks ago by esentis.dev

A toggle switch widget with an integrated loading state for asynchronous actions.

WASM-ready
$ flutter pub add load_switch
Source repository

What it does

A customizable toggle switch widget that handles asynchronous operations with a loading state. It supports both managed and controlled modes, various spinner styles from flutter_spinkit, and accessibility features.

AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a toggle switch that waits for a remote API call or async operation to finish.
  • You want built-in loading animations inside the thumb of a switch.
  • You require extensive customization of switch decoration, thumb shapes, and animations.

Skip it when

  • You only need a standard, non-loading Material or Cupertino switch.

Strengths

  • Supports both managed and controlled state modes.
  • Extensive customization options for shapes, colors, and animations.
  • Built-in accessibility support including semantics and keyboard navigation.

Weaknesses

  • Adds a dependency on flutter_spinkit for animations.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
bool value = false;

Future<bool> _toggle() async {
  await Future.delayed(const Duration(seconds: 2));
  return !value;
}

LoadSwitch.managed(
  value: value,
  onToggle: _toggle,
  onChanged: (nextValue) {
    setState(() {
      value = nextValue;
    });
  },
)

Alternatives

Packages that do the same job and could replace load_switch.

Works with

Packages commonly used together with load_switch: ones it builds on, ones built on it, and its own family.