{"id":21748285,"url":"https://github.com/surfstudio/macrofit","last_synced_at":"2025-09-14T20:51:01.306Z","repository":{"id":252780597,"uuid":"836155953","full_name":"surfstudio/macrofit","owner":"surfstudio","description":"Macro version of retrofit.dart","archived":false,"fork":false,"pushed_at":"2024-08-15T20:53:40.000Z","size":1212,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T07:13:14.405Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surfstudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2024-07-31T09:07:51.000Z","updated_at":"2024-10-04T19:26:33.000Z","dependencies_parsed_at":"2024-08-12T13:51:32.647Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/macrofit","commit_stats":null,"previous_names":["surfstudio/macrofit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fmacrofit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fmacrofit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fmacrofit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fmacrofit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/macrofit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675422,"owners_count":21143768,"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":"2024-11-26T08:12:55.316Z","updated_at":"2025-04-13T07:13:19.268Z","avatar_url":"https://github.com/surfstudio.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ~~Retro~~Macrofit for Dart\n\nmacrofit is a type conversion dio client generator based on macro feature and inspired by [retrofit.dart](https://pub.dev/packages/retrofit).\n\n\u003cimg height=\"400\" src=\"doc/image.png\"/\u003e\n\n### Setup\n\nSince macro is not stable yet, you need to enable it in your `analysis_options.yaml`:\n\n\n```yaml\ninclude: package:flutter_lints/flutter.yaml\n\nanalyzer:\n  enable-experiment:\n    - macros\n```\n\nAlso you need use flag `--enable-experiment=macros` when running your app:\n```shell\ndart run --enable-experiment=macros example/lib/example.dart\n```\n\n### Usage\n\n#### Client\n\nCreate your client:\n\n```dart\n@RestClient()\nclass ClientExample {\n\n    ClientExample(this._dio, [this.baseUrl]);\n}\n```\n\n#### Queries\n\nFill client with your queries. E.g.:\n```dart\n@RestClient()\nclass ClientExample {\n\n  ClientExample(this._dio, [this.baseUrl]);\n\n  @MultiPart('some/path')\n  external Future\u003cvoid\u003e someRequest(\n    @Part() String part1,\n    @Part() File photo,\n  );\n\n  @POST('/posts/{userId}')\n  external Future\u003cvoid\u003e updateProfile(\n    @Header('Test') String testHeader,\n    @Body() String name,\n    @Body() String surname,\n    String userId,\n  );\n\n  @DELETE('/posts/{id}')\n  external Future\u003cTestResponse\u003e deletePost(\n    @Header('Test') String id,\n  );\n\n  @GET('/posts')\n  external Future\u003cGenericResponse\u003cList\u003cdouble\u003e\u003e\u003e getPosts(\n    @Query() int page,\n    @Query() int limit,\n  );\n}\n```\n\n#### Methods\n\nThis library supports `GET`, `POST`, `PUT`, `DELETE` methods. Also you can define your own:\n```dart\n    @Custom('/posts/{id}', methodName: 'PATCH')\n    external Future\u003cPostEntity\u003e patchPost(int id, @Body() String title);\n```\n\n#### Parameters\n\nYou can use: \n- `@Query` for query parameters (e.g. `?page=1\u0026limit=10`)\n\n```dart\n    @GET('/posts')\n    external Future\u003cGenericResponse\u003cList\u003cdouble\u003e\u003e\u003e getPosts(\n      @Query() int page,\n      @Query() int limit,\n    );\n```\n\n- `@Body` for request body. E.g:\n\n```dart\n    @POST('/posts')\n    external Future\u003cvoid\u003e newPost(\n      @Body() String title,\n      @Body() String body,\n    );\n```\n\n- `@Header` for headers. E.g:\n\n```dart\n    @GET('/posts')\n    external Future\u003cPostEntity\u003e translate(\n      @Header('Locale') String locale,\n    );\n```\n\n- `@Part` for multi-part requests. E.g:\n\n```dart\n    @MultiPart('/posts')\n    external Future\u003cvoid\u003e newPost(\n      @Part() String title,\n      @Part() File photo,\n    );\n```\n\n- `@Path` for path parameters. Make sure to use the same name in the method and in the path. E.g:\n\n```dart\n    @GET('/posts/{id}')\n    external Future\u003cPostEntity\u003e getPost(int id);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fmacrofit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2Fmacrofit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fmacrofit/lists"}