{"id":18898406,"url":"https://github.com/hychen/flutter_js_asset","last_synced_at":"2026-05-07T05:32:28.154Z","repository":{"id":56829564,"uuid":"429814584","full_name":"hychen/flutter_js_asset","owner":"hychen","description":"Packing NPM modules for Flutter.","archived":false,"fork":false,"pushed_at":"2021-11-24T22:45:08.000Z","size":133,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T08:45:41.614Z","etag":null,"topics":["flutter"],"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/hychen.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}},"created_at":"2021-11-19T13:51:48.000Z","updated_at":"2021-11-24T22:39:08.000Z","dependencies_parsed_at":"2022-09-02T04:00:23.929Z","dependency_job_id":null,"html_url":"https://github.com/hychen/flutter_js_asset","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_asset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_asset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_asset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_asset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hychen","download_url":"https://codeload.github.com/hychen/flutter_js_asset/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239879317,"owners_count":19712176,"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"],"created_at":"2024-11-08T08:42:32.498Z","updated_at":"2026-03-01T10:30:15.734Z","avatar_url":"https://github.com/hychen.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nThis README describes the package. If you publish this package to pub.dev,\nthis README's contents appear on the landing page for your package.\n\nFor information about how to write a good package README, see the guide for\n[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).\n\nFor general information about developing packages, see the Dart guide for\n[creating packages](https://dart.dev/guides/libraries/create-library-packages)\nand the Flutter guide for\n[developing packages and plugins](https://flutter.dev/developing-packages).\n--\u003e\n\nInspired by [aspen](https://pub.dev/packages/aspen) but specified for using npm modules in\n[flutter_js](https://pub.dev/packages/flutter_js)\n\n## Features\n\n- Creates a .dart file containing constants that included javascript code read from specified files\n  by using `@TextAsset` annotation.\n\n## Getting started\n\n```\nflutter pub add -d build_runner\nflutter pub add flutter_js_asset\n```\n\nTo build, type\n\n```\nflutter pub run build_runner build\n```\nTo test, type\n\n```\nflutter pub run build_runner test\n```\n\n## Usage\n\n1. Create a npm module in `web` folder or any other folders are whitelisted because by default\n`package:build` only allows you to use assets from a pre-defined whitelist of directories.\n\n2. Installs packages you'd like to use and\n3. Create a `index.js` and exports modules to global object like this:\n\n```javascript\nmodule.exports.lib = require('name/of/module');\n```\n\n4. Generates a `bundle.js` by using webpack.\n5. Creates a dart file like this:\n\n```dart\nlibrary example;\n\nimport 'package:flutter_js_asset/annotations.dart';\n\npart 'example.g.dart';\n\n@TextAsset('asset:example/web/dist/bundle.js')\nconst String jsCode = $jsCodeContent;\n```\n\n6. Generates $jsCodeContent by typing:\n\n```sh\nflutter pub run build_runner build\n```\n\nsee `example` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhychen%2Fflutter_js_asset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhychen%2Fflutter_js_asset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhychen%2Fflutter_js_asset/lists"}