Dart 汉字转拼音,Flutter, web, other

Overview

lpinyin (Flutter汉字转拼音)

lpinyin是一个汉字转拼音的Dart Package. 主要参考Java开源类库jpinyin.
①准确、完善的字库
②拼音转换速度快
③支持多种拼音输出格式:带音标、不带音标、数字表示音标以及拼音首字母输出格式
④支持常见多音字的识别,其中包括词组、成语、地名等
⑤简繁体中文转换
⑥支持添加用户自定义字典

Pub

dependencies:
  lpinyin: ^2.0.2  #latest version

Example

// Import package
import 'package:lpinyin/lpinyin.dart';

String text = "天府广场";

//字符串拼音首字符
PinyinHelper.getShortPinyin(str); // tfgc

//字符串首字拼音
PinyinHelper.getFirstWordPinyin(str); // tian

//无法转换拼音会 throw PinyinException
PinyinHelper.getPinyin(text);
PinyinHelper.getPinyin(text, separator: " ", format: PinyinFormat.WITHOUT_TONE);//tian fu guang chang

//无法转换拼音 默认用' '替代
PinyinHelper.getPinyinE(text);
PinyinHelper.getPinyinE(text, separator: " ", defPinyin: '#', format: PinyinFormat.WITHOUT_TONE);//tian fu guang chang

//添加用户自定义字典
List<String> dict1 = ['耀=yào','老=lǎo'];
PinyinHelper.addPinyinDict(dict1);//拼音字典
List<String> dict2 = ['奇偶=jī,ǒu','成都=chéng,dū'];
PinyinHelper.addMultiPinyinDict(dict2);//多音字词组字典
List<String> dict3 = ['倆=俩','們=们'];
ChineseHelper.addChineseDict(dict3);//繁体字字典

Screenshots

Changelog

Please see the Changelog page to know what's recently changed.

App

Moss
A GitHub client app developed with Flutter, which supports Android iOS Web.
Web :Flutter Web.

You might also like...

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.

HtmlWidget monorepo This repo contains the source code for everything HtmlWidget-related. Name Link flutter_widget_from_html_core flutter_widget_from_

Jan 6, 2023

A Flutter plugin to rotate, resize, move, delete text, photo or any other widget.

A Flutter plugin to rotate, resize, move, delete text, photo or any other widget.

sticker_view A Flutter plugin to rotate, resize, move, delete any text, image or any other widget. Available Features ✅ Rotate ✅ Resize ✅ Move ✅ Layer

Nov 26, 2022

A Flutter plugin for sharing files & text with other applications.

esys_flutter_share A Flutter plugin for sharing files & text with other applications. IMPORTANT Note for iOS If you are starting a new fresh app, you

Sep 28, 2022

End-to-end mobile app templates that other developers can use during their Flutter development journey.

End-to-end mobile app templates that other developers can use during their Flutter development journey.

Flutter UI Templates Welcome Contributors 👋 The Robotics Forum always encourages new ideas. Aim 🎯 Main aim of this repository is to make things fast

Dec 18, 2022

A blogging application where users can publish their blogs and articles and can connect with other authors, developed using Flutter and Firebase.

A blogging application where users can publish their blogs and articles and can connect with other authors, developed using Flutter and Firebase.

Utopia About the app A blogging application where users can publish their blogs and articles and can connect with other authors, developed using Flutt

Jan 3, 2023

This project has the vision to assist the officials for Forest trees census and tagging each tree with proper location (latitude and longitude), tree type, and other arguments. and further had the plan to apply data analysis over-collected data.

🌳 Trees 🌳 🔖 Tagger 🔖 App & Analysis Software The vision of this project is to assist forest officials for tree census by tagging each tree with pr

Sep 29, 2022

Push Notification service for anime episodes and news. The episode updates will be based on actual upload on the internet and NOT Japan tv schedule as other apps do.

Push Notification service for anime episodes and news. The episode updates will be based on actual upload on the internet and NOT Japan tv schedule as other apps do.

Quantz Push Notification service for anime episodes and news. Features Sub and dub - get notified with latest anime episodes on the internet. Ongoing

Nov 21, 2022

Basic implementation of flutter_bloc with firebase auth and other related stuff :)

flutter_bloc_implementation A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get

Mar 7, 2022
Comments
  • flutter can't import lpinyin.dart

    flutter can't import lpinyin.dart

    flutter can't import lpinyin.dart,error as below:

    Try correcting the name to the name of an existing getter, or defining a getter or field named 'PinyinHelper'. String pinyin = PinyinHelper.getPinyinE(user.userName); ^^^^^^^^^^^^ Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Alpinyin%2Flpinyin.dart; message=StandardFileSystem only supports file:* and data:* URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)

    #1 asFileUri (package:vm/kernel_front_end.dart:601:37) #2
    FrontendCompiler._outputDependenciesDelta (package:vm/frontend_server.dart:401:39) #3 FrontendCompiler.compile (package:vm/frontend_server.dart:375: 13) #4 _FlutterFrontendCompiler.compile (package:frontend_ser ver/server.dart:31:22) #5 starter (package:frontend_server/s erver.dart:128:27) #6 main (file:///C:/b/s/w/ir/k/src/flutter/frontend_ser ver/bin/starter.dart:8:30) #7 _startIsolate. ( dart:isolate-patch/isolate_patch.dart:299:32) #8 _RawReceivePortImpl._handleMessage (dart:i solate-patch/isolate_patch.dart:172:12)

    opened by itlwy 2
  • getShortPinyin报错

    getShortPinyin报错

    像 "a,b" 这种会报错,中间是英文逗号,我试了中文逗号,句号,英文句号等都可以,唯独英文逗号不行,这么什么问题?

    The following RangeError was thrown while handling a gesture: RangeError (index): Invalid value: Valid value range is empty: 0

    When the exception was thrown, this was the stack: #0 _StringBase.[] (dart:core-patch/string_patch.dart:252:55) #1 PinyinHelper.getShortPinyin. (package:lpinyin/src/pinyin_helper.dart:51:21)

    opened by dreamfly32 1
  • Convert failed when starting with '李'

    Convert failed when starting with '李'

    demo:

    import 'package:lpinyin/lpinyin.dart';
    
    main() {
      print(PinyinHelper.getPinyin('李四',separator: ''));
      print(PinyinHelper.getPinyin('小李',separator: ''));
      print(PinyinHelper.getPinyin('王五',separator: ''));
    }
    

    output:

    李si
    xiaoli
    wangwu
    
    opened by ablipan 1
  • 拼音少了最后一个字母

    拼音少了最后一个字母

    separator为""的情况下,拼音会少了最后一个字母

    return (sb.toString().endsWith(separator) ? sb.toString().substring(0, sb.toString().length - 1) : sb.toString());

    opened by Cha0sX 1
Owner
Flutter中国开源项目
Flutter中文开发者社区开源项目。旨在开发一系列Flutter SDK之外常用(实用)的Package、插件,丰富Flutter第三方库,为Flutter生态贡献来自中国开发者的力量,欢迎所有志同道合的同学一起加入。
Flutter中国开源项目
Dart and Flutter sealed class generator and annotations, with match methods and other utilities. There is also super_enum compatible API.

Dart Sealed Class Generator Generate sealed class hierarchy for Dart and Flutter. Features Generate sealed class with abstract super type and data sub

6thSolution 15 Jan 2, 2023
A port of kotlin-stdlib for Dart/Flutter including immutable collections (KtList, KtMap, KtSet) and other packages

kt.dart This project is a port of Kotlin's Kotlin Standard library for Dart/Flutter projects. It's a useful addition to dart:core and includes collect

Pascal Welsch 460 Jan 9, 2023
This is a wallet application written in Flutter & Dart. Codebase could be shared effectively on other OS Platforms

Gwallet A Simple wallet application written in Flutter and Dart for Android and iOs. Getting Started For Android, Specifically. You can run iOS, by st

Gerald Maduabuchi 8 Dec 12, 2022
Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

Chance Dart Random generator helper for Dart Homepage • Documentation Overview Chance Dart is a free Open Source project that lets you create random s

Ayotomide 55 Dec 27, 2022
A zero-dependency web framework for writing web apps in plain Dart.

Rad Rad is a frontend framework for creating fast and interactive web apps using Dart. It's inspired from Flutter and shares same programming paradigm

null 70 Dec 13, 2022
Collection of cool Layouts built with Flutter to Inspire Other UI developers and explore the possibilities of Flutter.

Awesome_Flutter_Layouts Would you like to Contribute your Designs? Please refer the Contribution guidelines before you dive In Need help? or Looks Som

Mahesh Jamdade 103 Nov 22, 2022
Download files from Firebase Storage with Flutter. List all images, videos, or other files from Firebase and download them.

Flutter Tutorial - Download Files From Firebase Storage Download files from Firebase Storage with Flutter. List all images, videos, or other files fro

Johannes Milke 28 Dec 4, 2022
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

Johannes Milke 30 Dec 28, 2022
A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events

A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events. Android Go or Android 11 & above, this plugin shows notification bubble, in other android versions, it shows an overlay window.

Venkata Sai Vamsi Penupothu 85 Dec 29, 2022