1. 关于
HyakuninIsshu 是一个开源的 Dart 库。
使用 HyakuninIsshu,您可以轻松地在您的应用程序中使用百人一首资源。
1.1. 什么是百人一首?
Hyakunin Isshu (百人一首) 是一个经典的日本诗歌选集,包含一百位诗人的各一首和歌。百人一首可以翻译为“一人一首”;它也可以指使用基于百人一首的卡牌组成的牌组进行的歌牌游戏。
最著名和标准化的版本由藤原定家(1162–1241)在居住于京都小仓地区时编纂。因此,它也称为小仓百人一首。
您可以在 这里 查看更多详情!
1.2. 简介
1.2.1. 安装库
使用 Dart
dart pub add hyakunin_isshu
使用 Flutter
flutter pub add hyakunin_isshu
1.2.2. 导入
import 'package:hyakunin_isshu/hyakunin_isshu.dart';
1.2.3. 使用 HyakuninIsshu
import 'package:hyakunin_isshu/hyakunin_isshu.dart';
void main() async {
final response = await HyakuninIsshu.instance.cards();
print(response);
if (response.status.isNotOk) {
// Do something when http status is not OK (200).
return;
}
if (response.box.isEmpty) {
// Also you can check status by box.
return;
}
//! The resources of the Hyakunin Isshu are stored in GitHub repository,
//! so it will always succeed unless GitHub's server goes down!
for (final card in response.box.cards) {
print(card);
}
}
1.3. 许可证
Copyright (c) 2022, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
1.4. 更多信息
HyakuninIsshu 由加藤慎也设计和实现。