{"id":26051983,"url":"https://github.com/xamantra/elapsed","last_synced_at":"2025-06-13T01:06:39.564Z","repository":{"id":56828384,"uuid":"341522904","full_name":"xamantra/elapsed","owner":"xamantra","description":"Get time elapsed for asynchronous function in a single line of code.","archived":false,"fork":false,"pushed_at":"2021-03-13T21:39:13.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T05:47:01.203Z","etag":null,"topics":["dart","dartlang","elapsed","elapsed-time","library","plugin"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/elapsed","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xamantra.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}},"created_at":"2021-02-23T10:54:25.000Z","updated_at":"2021-12-28T20:53:15.000Z","dependencies_parsed_at":"2022-08-28T21:10:16.874Z","dependency_job_id":null,"html_url":"https://github.com/xamantra/elapsed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xamantra/elapsed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamantra%2Felapsed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamantra%2Felapsed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamantra%2Felapsed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamantra%2Felapsed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xamantra","download_url":"https://codeload.github.com/xamantra/elapsed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamantra%2Felapsed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259559708,"owners_count":22876501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dart","dartlang","elapsed","elapsed-time","library","plugin"],"created_at":"2025-03-08T05:47:08.522Z","updated_at":"2025-06-13T01:06:39.524Z","avatar_url":"https://github.com/xamantra.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.imgur.com/RsPh5tA.png\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003eGet time elapsed for asynchronous function in a single line of code.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pub.dev/packages/elapsed\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/pub/v/elapsed\" alt=\"Pub Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/xamantra/elapsed/actions/workflows/CI.yaml\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/xamantra/elapsed/actions/workflows/CI.yaml/badge.svg?branch=master\" alt=\"Testing Status\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/xamantra/elapsed\"\u003e\u003cimg src=\"https://codecov.io/gh/xamantra/elapsed/branch/master/graph/badge.svg?token=HDPBJXQZ9Q\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003chr\u003e\n\n\n## What does this do?\n- This package is written as a simplified form of [`Stopwatch`](https://api.dart.dev/stable/2.10.5/dart-core/Stopwatch-class.html) class. *And probably better*.\n- Only contains one method which is `elapsed(...)` .\n- Only accepts a `Future\u003cT\u003e` that the library will automatically await and record the time elapsed.\n- Where `\u003cT\u003e` can be of any type including `\u003cvoid\u003e` .\n- The time elapsed will be returned alongside the actual result of the future.\n\u003chr\u003e\n\n## **Normal** vs `package:elapsed`\nThis is how you normally call an API with `http` package.\n```dart\nvar response = await http.get(...);\nprint(response.body); // prints JSON data response.\n```\n\nBut with this library, you can do this:\n```dart\nvar data = await elapsed(http.get(...));\nprint(data.result.body); // prints JSON data response.\nprint(data.inMilliseconds); // prints time elapsed in milliseconds.\n// Also has \".inSeconds\" and \".inMinutes\"\n```\n\u003chr\u003e\n\n## Comparison\n**package:elapsed**\n\n\u003cimg src=\"https://i.imgur.com/WWoVOdz.png\" width=\"520\" alt=\"package:elapsed\"\u003e\n\u003chr\u003e\n\n**Stopwatch** class\n\n\u003cimg src=\"https://i.imgur.com/5bxRm5t.png\" width=\"520\" alt=\"manual implementation\"\u003e\n\u003chr\u003e\n\n**manual implementation**\n\n\u003cimg src=\"https://i.imgur.com/DH6AVCq.png\" width=\"520\" alt=\"manual implementation\"\u003e\n\u003chr\u003e\n\n\n## Types\nOf course. Types are supported. Like this:\n\n\u003cimg src=\"https://i.imgur.com/7ARx37C.png\" width=\"520\" alt=\"typed\"\u003e\n\u003chr\u003e\n\n## Null-safety\n```yaml\ndependencies:\n  # ...\n  elapsed: ^1.2.0 # use this version for null-safety. Requires dart 2.12.0 or Flutter 2.0.0 for flutter.\n  # OR\n  elapsed: 1.0.7 # no null-safety. can be used in older version of dart and flutter.\n  # ...\n```\n\n## Disclaimer\nThis is not an alternative to [`time_elapsed`](https://pub.dev/packages/time_elapsed). This is a very different library.\n\n\u003chr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxamantra%2Felapsed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxamantra%2Felapsed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxamantra%2Felapsed/lists"}