{"id":13552428,"url":"https://github.com/letsar/nil","last_synced_at":"2025-04-30T19:30:19.491Z","repository":{"id":40659827,"uuid":"347592181","full_name":"letsar/nil","owner":"letsar","description":"A simple Flutter widget to add in the widget tree when you want to show nothing, with minimal impact on performance.","archived":false,"fork":false,"pushed_at":"2022-04-29T23:36:43.000Z","size":21,"stargazers_count":154,"open_issues_count":4,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T04:05:15.355Z","etag":null,"topics":["flutter","flutter-package","flutter-widget"],"latest_commit_sha":null,"homepage":"","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/letsar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"letsar","patreon":"romainrastel","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/romainrastel","paypal.me/RomainRastel"]}},"created_at":"2021-03-14T09:19:12.000Z","updated_at":"2024-10-30T07:13:32.000Z","dependencies_parsed_at":"2022-08-10T00:10:44.712Z","dependency_job_id":null,"html_url":"https://github.com/letsar/nil","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsar%2Fnil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsar%2Fnil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsar%2Fnil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letsar%2Fnil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/letsar","download_url":"https://codeload.github.com/letsar/nil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251769138,"owners_count":21640845,"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":["flutter","flutter-package","flutter-widget"],"created_at":"2024-08-01T12:02:03.843Z","updated_at":"2025-04-30T19:30:19.145Z","avatar_url":"https://github.com/letsar.png","language":"Dart","funding_links":["https://github.com/sponsors/letsar","https://patreon.com/romainrastel","https://www.buymeacoffee.com/romainrastel","paypal.me/RomainRastel"],"categories":["Dart"],"sub_categories":[],"readme":"[![Build][github_action_badge]][github_action]\n[![Pub][pub_badge]][pub]\n[![Codecov][codecov_badge]][codecov]\n\n# nil\n\nA simple widget to add in the widget tree when you want to show nothing, with minimal impact on performance.\n\n## Why?\n\nSometimes, according to a condition, we want to display nothing. Usually when we can't return null, we would return something like `const SizedBox()` for example.\n\nThis is good, but it has some performance impacts since `SizedBox` creates a `RenderObject`. The `RenderObject` lives in the render tree and some computations are performed on it, even if it paints nothing on the screen.\n\nWe can do better, we can have a widget which does not create a `RenderObject`, while being still valid. The `Nil` widget is the minimal implementation for this use case. It only creates an `Element` and does nothing while it's building. Because the optimal way to use it, is to call `const Nil()`, it also comes with a `nil` constant that you can use everywhere (which is a `const Nil()`).\n\n## Usage\n\n``` dart\nimport 'package:nil/nil.dart';\n\nreturn Builder(\n  builder: (_) {\n    if (condition) {\n      return const MyWidget();\n    } else {\n      return nil;\n    }\n  },\n);\n```\n\n## Warning\n\nThis widget is not intended to be used in widgets accepting multiple children (e.g. `Rows`, `Columns`, etc.). The best option is to not add a widget in the list if you don't want it to be displayed. Moreover using a `Nil` widget in such a case, can have unexpected results.\n\n## Sponsoring\n\nI'm working on my packages on my free-time, but I don't have as much time as I would. If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.\n\n## Contributions\n\nFeel free to contribute to this project.\n\nIf you find a bug or want a feature, but don't know how to fix/implement it, please fill an [issue][issue].  \nIf you fixed a bug or implemented a feature, please send a [pull request][pr].\n\n\u003c!-- Links --\u003e\n[github_action_badge]: https://github.com/letsar/nil/workflows/Build/badge.svg\n[github_action]: https://github.com/letsar/nil/actions\n[pub_badge]: https://img.shields.io/pub/v/nil.svg\n[pub]: https://pub.dartlang.org/packages/nil\n[codecov]: https://codecov.io/gh/letsar/nil\n[codecov_badge]: https://codecov.io/gh/letsar/nil/branch/main/graph/badge.svg\n[issue]: https://github.com/letsar/nil/issues\n[pr]: https://github.com/letsar/nil/pulls\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsar%2Fnil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletsar%2Fnil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletsar%2Fnil/lists"}