{"id":27648361,"url":"https://github.com/polemius/avoid_non_null_assertion_operator","last_synced_at":"2025-04-24T02:39:04.927Z","repository":{"id":284836790,"uuid":"956192170","full_name":"polemius/avoid_non_null_assertion_operator","owner":"polemius","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-04T05:56:49.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T06:30:02.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/polemius.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":"2025-03-27T21:05:45.000Z","updated_at":"2025-04-04T05:56:52.000Z","dependencies_parsed_at":"2025-03-27T23:39:20.926Z","dependency_job_id":null,"html_url":"https://github.com/polemius/avoid_non_null_assertion_operator","commit_stats":null,"previous_names":["polemius/avoid_non_null_assertion_operator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Favoid_non_null_assertion_operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Favoid_non_null_assertion_operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Favoid_non_null_assertion_operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polemius%2Favoid_non_null_assertion_operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polemius","download_url":"https://codeload.github.com/polemius/avoid_non_null_assertion_operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250549240,"owners_count":21448811,"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":[],"created_at":"2025-04-24T02:39:04.289Z","updated_at":"2025-04-24T02:39:04.915Z","avatar_url":"https://github.com/polemius.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# avoid_non_null_assertion_operator\n\nA custom lint package for Dart/Flutter that helps enforce safer null handling by prohibiting the use of the non-null assertion operator (!).\n\n## Features\n\n- Detects and reports usage of the non-null assertion operator (!)\n- Helps enforce safer null handling practices\n- Integrates with Dart's analyzer\n\n## Getting started\n\nRun:\n```shell\ndart pub add --dev custom_lint avoid_non_null_assertion_operator\n```\n\nOr if using Flutter:\n```shell\nflutter pub add --dev custom_lint avoid_non_null_assertion_operator\n```\n\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndev_dependencies:\n  custom_lint:\n  avoid_non_null_assertion_operator:\n```\n\n## Usage\n\nAdd the following to your `analysis_options.yaml`:\n\n```yaml\nanalyzer:\n  plugins:\n    - custom_lint\n  errors:\n    avoid_non_null_assertion_operator: error\n```\n\nThe lint will now report errors for code like this:\n\n```dart\nString? nullable = \"test\";\nString nonNullable = nullable!; // Error: Avoid using the non-null assertion operator (!)\n```\n\nInstead, use safer alternatives like:\n\n```dart\nString? nullable = \"test\";\nString nonNullable = nullable ?? \"default\"; // Use null coalescing\n// or\nif (nullable != null) {\n  String nonNullable = nullable; // Use null check\n}\n```\n\n## Additional information\n\nThis package is designed to help maintain safer null handling practices in Dart/Flutter projects. It encourages the use of explicit null checks and null coalescing operators instead of force-unwrapping nullable values.\n\nFor more information about null safety in Dart, visit the [official documentation](https://dart.dev/null-safety).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolemius%2Favoid_non_null_assertion_operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolemius%2Favoid_non_null_assertion_operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolemius%2Favoid_non_null_assertion_operator/lists"}