{"id":23806773,"url":"https://github.com/webrpc/gen-dart","last_synced_at":"2026-06-13T21:31:38.721Z","repository":{"id":97512960,"uuid":"557932010","full_name":"webrpc/gen-dart","owner":"webrpc","description":"webrpc Dart client generator","archived":false,"fork":false,"pushed_at":"2024-04-25T16:26:48.000Z","size":335,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T23:14:18.775Z","etag":null,"topics":[],"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/webrpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-10-26T15:16:25.000Z","updated_at":"2024-08-13T08:12:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5097c8c-2bca-40ab-b9a5-61fa42154058","html_url":"https://github.com/webrpc/gen-dart","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Fgen-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Fgen-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Fgen-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webrpc%2Fgen-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webrpc","download_url":"https://codeload.github.com/webrpc/gen-dart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240059599,"owners_count":19741688,"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-01-01T23:14:22.233Z","updated_at":"2026-04-26T15:30:18.234Z","avatar_url":"https://github.com/webrpc.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gen-dart\n\nwebrpc-gen Dart templates\n===============================\n\nThis repo contains the templates used by the `webrpc-gen` cli to code-generate\nwebrpc Dart server and client code.\n\nThis generator, from a webrpc schema/design file will code-generate:\n\n1. Client -- an isomorphic/universal Dart client to speak to a webrpc server using the\nprovided schema. This client is compatible with any webrpc server language (ie. Go, nodejs, etc.).\n\n2. Server -- not yet supported\n\n## Dependencies\nThe generated client requires the standard `http` package to function. Add it to your pubspec.yaml \nin your Dart or Flutter project\n\n```\ndependencies:\n  # ... other dependencies\n  http: ^1.1.0\n```\n\n## Usage\n\n```\nwebrpc-gen -schema=example.ridl -target=dart -client -out=./example.gen.dart\n```\n\nor \n\n```\nwebrpc-gen -schema=example.ridl -target=github.com/webrpc/gen-dart@v0.17.2 -client -out=./example.gen.dart\n```\n\nor\n\n```\nwebrpc-gen -schema=example.ridl -target=./local-templates-on-disk -client -out=./example.gen.dart\n```\n\nAs you can see, the `-target` supports default `dart`, any git URI, or a local folder\n\n### Set custom template variables\nChange any of the following values by passing `-option=\"Value\"` CLI flag to `webrpc-gen`.\n\n| webrpc-gen -option   | Description                | Default value              |\n|----------------------|----------------------------|----------------------------|\n| `-client`            | generate client code       | unset (`false`)            |\n| `-server`            | generate server code       | unset (`false`)            |\n\n### Avoid using Records\nBecause Dart [Records do not retain runtime information about their structure](https://github.com/dart-lang/language/issues/2826), it's impossible\nto reliably convert them to and from JSON. For this reason, we strongly advise against\nusing Records in schema objects that have an `any` type (which maps to `dynamic` in Dart). In fact,\nyou probably should not ever use the `any` type in your schema because it has ambigious\nstructure which makes its structure meaningless on the other end of the wire. If you need a truly\nunstructured object, consider defining an internal convention and declaring it as a string in the schema.\n\n### Handle 64-bit numbers yourself\nNumbers (`double`, `num`, `int`) in Dart can have up to 64 bits of width. However, if you are\nusing Flutter and building for web, [numbers are limited to ~53 bits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER). In brief, \nthe consequence of this is that if your server sends a JSON number that is too big, it may be\ntruncated - the value will change - according to the platform (language + architecture) being used.\nSo, if you expected to use \"wide\" numbers (less than -(2^53 -1) or more than 2^53 - 1), you\nshould package those numbers as a string and use the appropriate tools to handle them inside\nyour app (such as `BigInt` in Dart).\n\n## CONTRIBUTE\n\n### Setup\nInstall Dart or Flutter. Ensure your version matches the `sdk` version specified in [tests/pubspec.yaml](tests/pubspec.yaml).\n\nFork this repo.\n\nRun the test scripts to ensure everything is set up correctly.\n```bash\ncd tests\n./scripts/download.sh v0.17.2 .tmp/\n./scripts/test.sh\n```\n\nGenerated code will be written to [tests/lib/client.dart](tests/lib/client.dart)\n\n### Make changes\nRefer to the [webrpc generator README](https://github.com/webrpc/webrpc/tree/master/gen) for help on syntax.\nIn brief, start in [main.go.tmpl] and traverse the template tree by going to the template file\nnamed by `{{template \"templateName\" \u003cargs\u003e}}`, e.g. \"templateName.go.tmpl\". \n\n### (Update and) Run tests\nFollowing the typical structure for a Dart package, tests are located in the aptly named\n[tests/test/](tests/test/).\n\n### Working with a local version of webrpc?\nIf you are working with a local version of the base `webrpc` repo, build the generator and test server scripts\nthere\n\n```bash\ncd path/to/webrpc\nmake build build-test\n```\n\nand pass the `webrpc/bin` directory to [tests/scripts/test.sh](tests/scripts/test.sh)\n\n```bash\ncd tests\n./scripts/test.sh -r path/to/webrpc/bin\n```\n\n## LICENSE\n\n[MIT LICENSE](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebrpc%2Fgen-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebrpc%2Fgen-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebrpc%2Fgen-dart/lists"}