{"id":28390790,"url":"https://github.com/flutterchina/lpinyin","last_synced_at":"2025-06-28T08:31:57.566Z","repository":{"id":40649368,"uuid":"144698803","full_name":"flutterchina/lpinyin","owner":"flutterchina","description":"Dart 汉字转拼音，Flutter, web, other","archived":false,"fork":false,"pushed_at":"2023-05-06T11:33:24.000Z","size":530,"stargazers_count":365,"open_issues_count":4,"forks_count":51,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-31T16:37:44.177Z","etag":null,"topics":["dart","flutter","pinyin"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flutterchina.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}},"created_at":"2018-08-14T09:29:41.000Z","updated_at":"2025-05-07T10:16:00.000Z","dependencies_parsed_at":"2022-09-09T14:01:01.340Z","dependency_job_id":"a35bde4e-1f66-4e0a-8f64-a7284de82c86","html_url":"https://github.com/flutterchina/lpinyin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flutterchina/lpinyin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutterchina%2Flpinyin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutterchina%2Flpinyin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutterchina%2Flpinyin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutterchina%2Flpinyin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flutterchina","download_url":"https://codeload.github.com/flutterchina/lpinyin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutterchina%2Flpinyin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262400617,"owners_count":23305326,"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":["dart","flutter","pinyin"],"created_at":"2025-05-31T06:12:30.103Z","updated_at":"2025-06-28T08:31:57.560Z","avatar_url":"https://github.com/flutterchina.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lpinyin (Flutter汉字转拼音)\n\nlpinyin是一个汉字转拼音的Dart Package. 主要参考Java开源类库[jpinyin](https://github.com/SilenceDut/jpinyin).  \n①准确、完善的字库  \n②拼音转换速度快  \n③支持多种拼音输出格式：带音标、不带音标、数字表示音标以及拼音首字母输出格式  \n④支持常见多音字的识别，其中包括词组、成语、地名等  \n⑤简繁体中文转换  \n⑥支持添加用户自定义字典\n\n## Pub\n\n```yaml\ndependencies:\n  lpinyin: ^2.0.2  #latest version\n```\n\n## Example\n\n``` dart\n\n// Import package\nimport 'package:lpinyin/lpinyin.dart';\n\nString text = \"天府广场\";\n\n//字符串拼音首字符\nPinyinHelper.getShortPinyin(str); // tfgc\n\n//字符串首字拼音\nPinyinHelper.getFirstWordPinyin(str); // tian\n\n//无法转换拼音会 throw PinyinException\nPinyinHelper.getPinyin(text);\nPinyinHelper.getPinyin(text, separator: \" \", format: PinyinFormat.WITHOUT_TONE);//tian fu guang chang\n\n//无法转换拼音 默认用' '替代\nPinyinHelper.getPinyinE(text);\nPinyinHelper.getPinyinE(text, separator: \" \", defPinyin: '#', format: PinyinFormat.WITHOUT_TONE);//tian fu guang chang\n\n//添加用户自定义字典\nList\u003cString\u003e dict1 = ['耀=yào','老=lǎo'];\nPinyinHelper.addPinyinDict(dict1);//拼音字典\nList\u003cString\u003e dict2 = ['奇偶=jī,ǒu','成都=chéng,dū'];\nPinyinHelper.addMultiPinyinDict(dict2);//多音字词组字典\nList\u003cString\u003e dict3 = ['倆=俩','們=们'];\nChineseHelper.addChineseDict(dict3);//繁体字字典\n\n```\n\n## Screenshots\n![](https://s1.ax1x.com/2020/11/05/B2fwQO.gif)\n\n## Changelog\nPlease see the [Changelog](CHANGELOG.md) page to know what's recently changed.\n\n## App\n[Moss](https://github.com/Sky24n/Moss)  \nA GitHub client app developed with Flutter, which supports Android iOS Web.  \nWeb ：[Flutter Web](https://sky24n.github.io/Sky24n/moss).\n\n|![](https://z3.ax1x.com/2021/04/26/gp1hm6.jpg)|![](https://z3.ax1x.com/2021/04/26/gp1Tte.jpg)|![](https://z3.ax1x.com/2021/04/26/gp17fH.jpg)|\n|:---:|:---:|:---:|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutterchina%2Flpinyin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflutterchina%2Flpinyin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutterchina%2Flpinyin/lists"}