{"id":13446206,"url":"https://github.com/fluttercommunity/import_sorter","last_synced_at":"2025-04-05T09:09:31.935Z","repository":{"id":39709514,"uuid":"256888317","full_name":"fluttercommunity/import_sorter","owner":"fluttercommunity","description":"🎯  Automatically organize your dart imports. Maintainer: @gleich","archived":false,"fork":false,"pushed_at":"2024-03-16T20:19:53.000Z","size":399,"stargazers_count":177,"open_issues_count":26,"forks_count":41,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T08:08:27.758Z","etag":null,"topics":["code-quality","dart","dart-imports","dart-package","documentation","flutter","sorter"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/import_sorter","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/fluttercommunity.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":"2020-04-19T01:24:10.000Z","updated_at":"2025-02-17T14:55:07.000Z","dependencies_parsed_at":"2024-01-23T22:27:06.035Z","dependency_job_id":"67229d5d-f004-40e7-9d6a-dad64ad7f34d","html_url":"https://github.com/fluttercommunity/import_sorter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fimport_sorter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fimport_sorter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fimport_sorter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fimport_sorter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercommunity","download_url":"https://codeload.github.com/fluttercommunity/import_sorter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312082,"owners_count":20918344,"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":["code-quality","dart","dart-imports","dart-package","documentation","flutter","sorter"],"created_at":"2024-07-31T05:00:48.283Z","updated_at":"2025-04-05T09:09:31.887Z","avatar_url":"https://github.com/fluttercommunity.png","language":"Dart","funding_links":[],"categories":["Developer Utilities","Dart"],"sub_categories":[],"readme":"\u003c!-- DO NOT REMOVE - contributor_list:data:start:[\"gleich\", \"mrgnhnt96\", \"lig\", \"vkammerer\", \"bartekpacia\", \"pythonhubdev\", \"ImgBotApp\", \"jlnrrg\", \"vHanda\"]:end --\u003e\n\n```txt\n ___  _____ ______   ________  ________  ________  _________\n|\\  \\|\\   _ \\  _   \\|\\   __  \\|\\   __  \\|\\   __  \\|\\___   ___\\\n\\ \\  \\ \\  \\\\\\__\\ \\  \\ \\  \\|\\  \\ \\  \\|\\  \\ \\  \\|\\  \\|___ \\  \\_|\n \\ \\  \\ \\  \\\\|__| \\  \\ \\   ____\\ \\  \\\\\\  \\ \\   _  _\\   \\ \\  \\\n  \\ \\  \\ \\  \\    \\ \\  \\ \\  \\___|\\ \\  \\\\\\  \\ \\  \\\\  \\|   \\ \\  \\\n   \\ \\__\\ \\__\\    \\ \\__\\ \\__\\    \\ \\_______\\ \\__\\\\ _\\    \\ \\__\\\n    \\|__|\\|__|     \\|__|\\|__|     \\|_______|\\|__|\\|__|    \\|__|\n    ________  ________  ________  _________  _______   ________\n   |\\   ____\\|\\   __  \\|\\   __  \\|\\___   ___\\\\  ___ \\ |\\   __  \\\n   \\ \\  \\___|\\ \\  \\|\\  \\ \\  \\|\\  \\|___ \\  \\_\\ \\   __/|\\ \\  \\|\\  \\\n    \\ \\_____  \\ \\  \\\\\\  \\ \\   _  _\\   \\ \\  \\ \\ \\  \\_|/_\\ \\   _  _\\\n     \\|____|\\  \\ \\  \\\\\\  \\ \\  \\\\  \\|   \\ \\  \\ \\ \\  \\_|\\ \\ \\  \\\\  \\|\n       ____\\_\\  \\ \\_______\\ \\__\\\\ _\\    \\ \\__\\ \\ \\_______\\ \\__\\\\ _\\\n      |\\_________\\|_______|\\|__|\\|__|    \\|__|  \\|_______|\\|__|\\|__|\n      \\|_________|\n```\n\n# Request for a Maintainer\n\nThis project needs a maintainer as I no longer work with dart and flutter. Please see [the issue thread](https://github.com/fluttercommunity/import_sorter/issues/63) for more information.\n\n# [import_sorter](https://pub.dev/packages/import_sorter) ![Pub Version](https://img.shields.io/pub/v/import_sorter)\n\n[![Flutter Community: import_sorter](https://fluttercommunity.dev/_github/header/import_sorter)](https://github.com/fluttercommunity/community)\n\n![test](https://github.com/fluttercommunity/import_sorter/workflows/test/badge.svg)\n![format](https://github.com/fluttercommunity/import_sorter/workflows/format/badge.svg)\n\n🎯 Dart package to automatically organize your dart imports. Any dart project supported! Will sorts imports alphabetically and then group them in the following order:\n\n1. Dart imports\n2. Flutter imports\n3. Package imports\n4. Project imports\n\nBelow is an example:\n\n### Before\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter/cupertino.dart';\nimport 'package:flutter/physics.dart';\nimport 'package:flutter/painting.dart';\nimport 'package:intl/intl.dart';\nimport 'package:mdi/mdi.dart';\nimport 'package:provider/provider.dart';\nimport 'anotherFile.dart';\nimport 'package:example_app/anotherFile2.dart';\nimport 'dart:async';\nimport 'dart:io';\nimport 'dart:js';\n```\n\n### After\n\n```dart\n// Dart imports:\nimport 'dart:async';\nimport 'dart:io';\nimport 'dart:js';\n\n// Flutter imports:\nimport 'package:flutter/cupertino.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/painting.dart';\nimport 'package:flutter/physics.dart';\n\n// Package imports:\nimport 'package:intl/intl.dart';\nimport 'package:mdi/mdi.dart';\nimport 'package:provider/provider.dart';\n\n// Project imports:\nimport 'package:example_app/anotherFile2.dart';\nimport 'anotherFile.dart';\n```\n\n## 🚀 Installing\n\nSimply add `import_sorter: ^4.6.0` to your `pubspec.yaml`'s `dev_dependencies`.\n\n## 🏃‍♂️ Running\n\nOnce you've installed it simply run `flutter pub run import_sorter` (`pub run import_sorter` if normal dart application) to format every file dart file in your lib, bin, test, and tests folder! Don't worry if these folders don't exist.\n\n## 💻 Command Line\n\n- Add the `-e` flag to the run command and have emojis added to your imports 😄.\n- If you're using a config in the `pubspec.yaml` you can have the program ignore it by adding `--ignore-config`.\n- Want to make sure your files are sorted? Add `--exit-if-changed` to make sure the files are sorted. Good for things like CI.\n- Have no comments before your imports by adding the `--no-comments` flag.\n- Add the `-h` flag if you need any help from the command line!\n- You can only run import_sorter on certain files by passing in a regular expression(s) that will only sort certain files. Below are two examples:\n  - `pub run import_sorter bin/main.dart lib/args.dart` (only sorts bin/main.dart and lib/args.dart)\n  - `pub run import_sorter lib\\/* test\\/*` (only sorts files in the lib and test folders)\n\n## 🏗️ Config\n\nIf you use import_sorter a lot or need to ignore certain files you should look at using the config you put in your `pubspec.yaml`. Ignored files are in the format of regex. This regex is then applied to the project root path (the one outputted to the terminal). Below is an example config setting emojis to true and ignoring all files in the lib folder:\n\n```yaml\nimport_sorter:\n  emojis: true # Optional, defaults to false\n  comments: false # Optional, defaults to true\n  ignored_files: # Optional, defaults to []\n    - \\/lib\\/*\n```\n\nIf you need another example check the [example app's import_sorter configuration](https://github.com/fluttercommunity/import_sorter/blob/master/example/example_app/pubspec.yaml#L76).\n\n## 🚨 [`pre-commit`](https://pre-commit.com/) Hook\n\nThere are two pre-commit hooks available: `dart-import-sorter` and `flutter-import-sorter`. They use `pub run` and `flutter pub run` respectively. Use the former for a generic Dart project and the latter for a Flutter project.\n\nUsing pre-commit hooks in your project:\n\n- Install and configure `pre-commit`.\n- Install and configure `import_sorter` using instructions above.\n- Add the following to the `repos` section of your `.pre-commit-config.yaml`:\n\n```yaml\n- repo: https://github.com/fluttercommunity/import_sorter\n  rev: 'master'\n  hooks:\n    - id: dart-import-sorter # use `flutter-import-sorter` for a Flutter project\n```\n\n- Run initial sort:\n\n```shell\npre-commit run --all-files\n```\n\n## 🙋‍♀️🙋‍♂️ Contributing\n\nAll contributions are welcome! Just make sure that it's not an already existing issue or pull request.\n\n\u003c!-- DO NOT REMOVE - contributor_list:start --\u003e\n## 👥 Contributors\n\n\n- **[@gleich](https://github.com/gleich)**\n\n- **[@mrgnhnt96](https://github.com/mrgnhnt96)**\n\n- **[@lig](https://github.com/lig)**\n\n- **[@vkammerer](https://github.com/vkammerer)**\n\n- **[@bartekpacia](https://github.com/bartekpacia)**\n\n- **[@pythonhubdev](https://github.com/pythonhubdev)**\n\n- **[@ImgBotApp](https://github.com/ImgBotApp)**\n\n- **[@jlnrrg](https://github.com/jlnrrg)**\n\n- **[@vHanda](https://github.com/vHanda)**\n\n\u003c!-- DO NOT REMOVE - contributor_list:end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fimport_sorter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercommunity%2Fimport_sorter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fimport_sorter/lists"}