{"id":15177517,"url":"https://github.com/mubashardev/debounce_controller","last_synced_at":"2026-02-03T16:34:28.971Z","repository":{"id":254442370,"uuid":"846555903","full_name":"mubashardev/debounce_controller","owner":"mubashardev","description":"A Flutter package for debounced text input handling with asynchronous operations, powered by GetX. Easily manage multiple controllers, handle errors, and create responsive search experiences.","archived":false,"fork":false,"pushed_at":"2024-08-23T13:58:43.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T09:25:11.158Z","etag":null,"topics":["debounce","debounce-input","flutter","flutter-debounce","getx"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/debounce_controller","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mubashardev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T13:08:12.000Z","updated_at":"2024-08-23T13:58:46.000Z","dependencies_parsed_at":"2024-08-23T14:28:04.420Z","dependency_job_id":null,"html_url":"https://github.com/mubashardev/debounce_controller","commit_stats":null,"previous_names":["microprogramer/debounce_controller","mubashardev/debounce_controller"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mubashardev/debounce_controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubashardev%2Fdebounce_controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubashardev%2Fdebounce_controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubashardev%2Fdebounce_controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubashardev%2Fdebounce_controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mubashardev","download_url":"https://codeload.github.com/mubashardev/debounce_controller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mubashardev%2Fdebounce_controller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29049163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debounce","debounce-input","flutter","flutter-debounce","getx"],"created_at":"2024-09-27T14:40:18.237Z","updated_at":"2026-02-03T16:34:28.950Z","avatar_url":"https://github.com/mubashardev.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DebounceController\n\n`DebounceController` is a Flutter package that provides a simple yet powerful way to handle debounced text input operations with support for asynchronous functions. It leverages the `GetX` package for reactive state management and allows for easy integration of debounce functionality in your Flutter applications.\n\n## Features\n\n- **Debounced Text Input**: Prevents frequent calls to a function while typing.\n- **Asynchronous Operation Support**: Handle complex operations like API requests seamlessly.\n- **Multiple Controller Support**: Create and manage multiple `DebounceController` instances using unique tags.\n- **Error Handling**: Custom error handling with callback support.\n- **Reactive State Management**: Built on top of `GetX`, providing a reactive experience.\n\n## Installation\n\nAdd the following to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  debounce_controller: \u003clatest_version\u003e\n  get: \u003clatest_version\u003e\n```\n\nThen run `flutter pub get` to install the package.\n\n## Usage\n\n### 1. Import the package\n\n```dart\nimport 'package:debounce_controller/debounce_controller.dart';\nimport 'package:get/get.dart';\nimport 'package:flutter/material.dart';\n```\n\n### 2. Create a DebounceController\n\nYou can create a `DebounceController` instance using `Get.put` with an optional tag if you need multiple controllers:\n\n```dart\nfinal searchController1 = Get.put(\n  () =\u003e DebounceController\u003cString\u003e(\n    futureOperation: _searchOperation,\n  ),\n  tag: 'searchController1',\n);\n```\n\n### 3. Implement the Future Operation\n\nThe `DebounceController` requires a `Future\u003cList\u003cT\u003e\u003e Function(TextEditingController)` to process the text input:\n\n```dart\nFuture\u003cList\u003cString\u003e\u003e _searchOperation(TextEditingController controller) async {\n  await Future.delayed(Duration(seconds: 1)); // Simulate network delay\n  return List.generate(5, (index) =\u003e 'Result ${index + 1} for \"${controller.text}\"');\n}\n```\n\n### 4. Build the UI\n\nUse the `DebounceController` in your UI, reacting to data and loading states:\n\n```dart\nObx(() {\n  if (searchController1.loading.value) {\n    return CircularProgressIndicator();\n  }\n  return Expanded(\n    child: ListView.builder(\n      itemCount: searchController1.data.length,\n      itemBuilder: (context, index) {\n        return ListTile(\n          title: Text(searchController1.data[index].toString()),\n        );\n      },\n    ),\n  );\n}),\n```\n\n### 5. Full Example\n\nHere’s a complete example in `main.dart`:\n\n```dart\nimport 'package:debounce_controller/debounce_controller.dart';\nimport 'package:flutter/material.dart';\nimport 'package:get/get.dart';\n\nvoid main() {\n  runApp(const MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n  const MyApp({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    return const GetMaterialApp(\n      title: 'DebounceController Example',\n      home: HomeScreen(),\n    );\n  }\n}\n\nclass HomeScreen extends StatelessWidget {\n  const HomeScreen({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    // Creating multiple DebounceController instances using tags.\n    final searchController1 = Get.put(\n      DebounceController\u003cString\u003e(\n        futureOperation: _searchOperation,\n      ),\n      tag: 'searchController1',\n    );\n\n    final searchController2 = Get.put(\n      DebounceController\u003cString\u003e(\n        futureOperation: _searchOperation,\n      ),\n      tag: 'searchController2',\n    );\n\n    return Scaffold(\n      appBar: AppBar(title: const Text('DebounceController Example')),\n      body: Column(\n        children: [\n          Padding(\n            padding: const EdgeInsets.all(8.0),\n            child: TextFormField(\n              controller: searchController1.textEditingController,\n              decoration: const InputDecoration(\n                labelText: 'Search 1',\n                border: OutlineInputBorder(),\n              ),\n            ),\n          ),\n          Padding(\n            padding: const EdgeInsets.all(8.0),\n            child: TextField(\n              controller: searchController2.textEditingController,\n              decoration: const InputDecoration(\n                labelText: 'Search 2',\n                border: OutlineInputBorder(),\n              ),\n            ),\n          ),\n          Obx(() {\n            if (searchController1.loading.value) {\n              return const CircularProgressIndicator();\n            }\n            return Expanded(\n              child: ListView.builder(\n                itemCount: searchController1.data.length,\n                itemBuilder: (context, index) {\n                  return ListTile(\n                    title: Text(searchController1.data[index].toString()),\n                  );\n                },\n              ),\n            );\n          }),\n        ],\n      ),\n    );\n  }\n\n  // Example async search operation, replace with actual implementation.\n  Future\u003cList\u003cString\u003e\u003e _searchOperation(TextEditingController controller) async {\n    await Future.delayed(const Duration(seconds: 1)); // Simulate network delay\n    return List.generate(5, (index) =\u003e 'Result ${index + 1} for \"${controller.text}\"');\n  }\n}\n\n```\n\n### 6. Error Handling\n\nYou can handle errors using the `onError` parameter:\n\n```dart\nfinal searchController = Get.put(\n  () =\u003e DebounceController\u003cString\u003e(\n    futureOperation: _searchOperation,\n    onError: (error, stackTrace) {\n      print('Error: $error');\n    },\n  ),\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmubashardev%2Fdebounce_controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmubashardev%2Fdebounce_controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmubashardev%2Fdebounce_controller/lists"}