dart_debouncer 1.1.0 copy "dart_debouncer: ^1.1.0" to clipboard
dart_debouncer: ^1.1.0 copied to clipboard

A package for creating debounce in dart will possibilities of multi instances debounce. No singleton pattern

example/example.dart

import 'package:dart_debouncer/dart_debouncer.dart';
import 'package:flutter/material.dart';

class Example extends StatefulWidget {
  const Example({super.key});

  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  final Debouncer debouncer = Debouncer(
    timerDuration: const Duration(seconds: 1),
  );
  final emailEC = TextEditingController();

  String typedText = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      ppBar: AppBar(
        title: Text(typedText),
      ),
      body: Center(
        child: TextField(
          controller: emailEC,
          onChanged: (value) {
            debouncer.resetDebounce(() {
              /// Will only set value after 1 second of no typing
              typedText = value;
            });
          },
        ),
      ),
    );
  }
}
7
likes
160
points
551
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

A package for creating debounce in dart will possibilities of multi instances debounce. No singleton pattern

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on dart_debouncer