function_filter 1.1.2 copy "function_filter: ^1.1.2" to clipboard
function_filter: ^1.1.2 copied to clipboard

A Dart library for function filtering utilities, providing tools for debouncing and throttling function executions based on time intervals.

example/main.dart

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

void main() {
  runApp(const MaterialApp(home: DemoApp()));
}

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

  @override
  State<StatefulWidget> createState() => _DemoAppState();
}

class _DemoAppState extends State<DemoApp> {
  var _counter = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            SizedBox(height: 100),
            Text('$_counter'),
            SizedBox(height: 50),
            MaterialButton(
              onPressed: () => FunctionFilter.debounce(
                this,
                const Duration(milliseconds: 500),
                () {
                  setState(() {
                    ++_counter;
                  });
                },
              ),
              child: Text('Debounce +1'),
            ),
            SizedBox(height: 50),
            MaterialButton(
              onPressed: () => FunctionFilter.throttle(
                this,
                const Duration(milliseconds: 500),
                () {
                  setState(() {
                    ++_counter;
                  });
                },
              ),
              child: Text('Throttle +1'),
            ),
          ],
        ),
      ),
    );
  }
}
9
likes
0
pub points
37%
popularity

Publisher

verified publishermopriestt.com

A Dart library for function filtering utilities, providing tools for debouncing and throttling function executions based on time intervals.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on function_filter