A Flutter package to encode and decode lrc.
DOCS/文档
Features
- You can use it to parse music lyric String (.lrc), lrc look like:
00.11.22
hello coolight
- And than return a object for reading and writing easily.
lyric_xx
support so many lrc standard and non-standard format,- we follow
casually decode
andstrictly encode
- such as:
- info:
ti:xxx
ar:xxx
hello:xxx
- ......
- lyric:
minute:second.millisecond
lyricContent- like
01:11.22
hello
- like
minute:second:millisecond
lyricContent- like
01:11:22
hello
- like
minute:second
lyricContent- like
01:11
hello
- like
- translate:
- no time Or same time:
[01:11.22] lyricContent1
lyricContent1 translate
[01:33.22] lyricContent2
[01:33.22] lyricContent2 translate
- mulit-time in one line:
minute2:second2
lyricContent To:minute:second.millisecond
lyricContent- And
minute2:second2
lyricContent
- time after lyricContent:
- lyricContent
minute:second.millisecond
- lyricContent
Getting started
- install this package, add this line in your
pubspec.yaml
:
lyric_xx:
- import when you want to use this package:
import 'package:lyric_xx/lyric_xx.dart';
Usage
- parse .lrc String to Objects:
void test() {
final lrcStr = """
[ti:天后]
[ar:陈势安]
[00:27.43]终于找到借口
[00:30.33]趁着醉意上心头
[00:33.28]表达我所有感受
""";
final relist = Lyricxx_c.decodeLrcString(
lrcStr,
);
}
- encode to .lrc:
void test() async {
// lrc object list
final List<LyricSrcItemEntity_c> lrcList = [];
final lrcStr = Lyricxx_c.encodeLrcString(
lrcList,
);
/// write to file:
final file = File("./test.lrc");
// create file
if(false == await file.exists()) {
await file.create(recursive: true);
}
// write
await refile.writeAsString(lrcStr);
}