{"id":31828653,"url":"https://github.com/kerberjg/dart_coroutines","last_synced_at":"2026-07-20T17:35:34.543Z","repository":{"id":315970607,"uuid":"1056345064","full_name":"kerberjg/dart_coroutines","owner":"kerberjg","description":"♻️📝 Resumable functions for Flutter/Dart","archived":false,"fork":false,"pushed_at":"2026-01-21T11:25:16.000Z","size":55,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-07-20T17:35:09.866Z","etag":null,"topics":["async","coroutines","gamedev","resumable","widgets"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/coroutines","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kerberjg.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-13T22:19:57.000Z","updated_at":"2026-05-09T23:33:39.000Z","dependencies_parsed_at":"2025-09-22T00:09:43.591Z","dependency_job_id":"888f40e3-1ccb-4624-9207-405eeef8920a","html_url":"https://github.com/kerberjg/dart_coroutines","commit_stats":null,"previous_names":["kerberjg/dart_coroutines"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kerberjg/dart_coroutines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerberjg%2Fdart_coroutines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerberjg%2Fdart_coroutines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerberjg%2Fdart_coroutines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerberjg%2Fdart_coroutines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kerberjg","download_url":"https://codeload.github.com/kerberjg/dart_coroutines/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerberjg%2Fdart_coroutines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35695246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"ssl_error","status_checked_at":"2026-07-20T02:08:09.736Z","response_time":111,"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":["async","coroutines","gamedev","resumable","widgets"],"created_at":"2025-10-11T19:59:13.732Z","updated_at":"2026-07-20T17:35:34.538Z","avatar_url":"https://github.com/kerberjg.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coroutines\nResumable functions for Flutter/Dart (Unity-style)\n\n\u003c!-- Badges --\u003e\n[![pub package](https://img.shields.io/pub/v/coroutines.svg)](https://pub.dev/packages/coroutines)\n[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](LICENSE)\n[![build](https://github.com/kerberjg/dart_coroutines/actions/workflows/package.yaml/badge.svg)](https://github.com/kerberjg/dart_coroutines/actions/workflows/package.yaml)\n[![examples](https://github.com/kerberjg/dart_coroutines/actions/workflows/examples.yaml/badge.svg)](https://github.com/kerberjg/dart_coroutines/actions/workflows/examples.yaml)\n[![stars](https://img.shields.io/github/stars/kerberjg/dart_coroutines.svg)](https://github.com/kerberjg/dart_coroutines/stargazers)\n\n\n# Features\n- Lightweight and easy to use\n- Supports both synchronous and asynchronous coroutines\n- Can be easily integrated into existing Flutter/Dart applications\n\n\u003c!-- TODO(kerberjg): Insert a warning about usability and provide links to recommended practices --\u003e\n\n# Installation\nAdd the following dependency to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  coroutines: ^0.2.1\n```\n\n# Examples\n\n- [Flutter, coroutine on button press](#with-widgets)\n- ~Flutter, coroutine every frame~ (coming soon!)\n- [Flame game engine](examples/flame_with_coroutines/lib/main.dart) by @luanpotter\n- ~Fluorite game engine~ (coming soon!)\n\n## With widgets\n\nIn this example, a StatefulWidget uses the CoroutineExecutor mixin to run a coroutine that updates every time\na button is pressed.\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:coroutines/coroutines.dart';\n\nclass MyWidget extends StatefulWidget {\n  @override\n  _MyWidgetState createState() =\u003e _MyWidgetState();\n}\n\nclass _MyWidgetState extends State\u003cMyWidget\u003e with CoroutineExecutor {\n  int _counter = 0;\n\n  void _incrementCounter() {\n    runCoroutine(_myCoroutine);\n  }\n\n  CoroutineValue\u003cint\u003e _myCoroutine() sync* {\n    while (true) {\n      yield _counter++;\n    }\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text('Coroutine Example'),\n      ),\n      body: Center(\n        child: Text('Counter: $_counter'),\n      ),\n      floatingActionButton: FloatingActionButton(\n        onPressed: _incrementCounter,\n        child: Icon(Icons.add),\n      ),\n    );\n  }\n}\n```\n\n## Game objects\n\n```dart\n\nclass JumpingCube extends GameObject with CoroutineExecutor {\n  double jumpSpeed = 10;\n  double fallSpeed = -5\n\n  bool isOnGround() {\n    // Check if the cube is on the ground\n  }\n\n  /// Started when a jump button is pressed, iterates every frame to continue the jump animation\n  CoroutineValue\u003cbool\u003e _jumpCoroutine() sync* {\n    double verticalSpeed = jumpSpeed;\n\n    while(!isOnGround()) {\n      verticalSpeed -= 0.25; // apply gravity\n      verticalSpeed = verticalSpeed.clamp(fallSpeed, double.infinity); // clamp to terminal velocity\n\n      position.y += verticalSpeed; // move the cube\n      yield true;\n    }\n\n    return false; // end of jump\n  }\n\n  @override\n  void onKeyPressed(KeyEvent event) {\n    // \"An A-press is an A-press, you can't say it's only a half\" - well, TJ \"Henry\" Yoshi...\n    if(event is KeyDownEvent \u0026\u0026 event.logicalKey == LogicalKeyboardKey.keyA) {\n      addCoroutine(_jumpCoroutine);\n    }\n  }\n\n  @override\n  void update(double deltaTime) {\n    runAllCoroutines();\n  }\n}","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerberjg%2Fdart_coroutines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkerberjg%2Fdart_coroutines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerberjg%2Fdart_coroutines/lists"}