armyknife_time 1.0.0 copy "armyknife_time: ^1.0.0" to clipboard
armyknife_time: ^1.0.0 copied to clipboard

Light-Weight Time libraries wrapper.

軽量な時刻処理ライブラリである。time_machineパッケージをベースに、開発者が使いやすい機能を追加している。

Features #

  • 軽量な時刻処理: time_machineパッケージのラッパーとして、効率的な時刻処理を提供
  • ClockDelegate: テストやモッキングに便利なClockのデリゲート実装
  • InstantX: Instantクラスの拡張機能(Unix エポック定数、ミリ秒単位の現在時刻取得)

Getting started #

pubspec.yaml に以下を追加してください:

dependencies:
  armyknife_time: ^1.0.0

Usage #

基本的な時刻処理:

import 'package:armyknife_time/armyknife_time.dart';

void main() {
  // 現在時刻を取得
  final now = Instant.now();
  print('現在時刻: $now');

  // ミリ秒単位の現在時刻を取得
  final nowMillis = InstantX.nowMilliSeconds();
  print('現在時刻(ミリ秒): $nowMillis');

  // Unixエポック時刻を取得
  final epoch = InstantX.epoch;
  print('Unixエポック: $epoch');

  // ClockDelegateを使用したカスタム時刻
  final customClock = ClockDelegate(
    getCurrentInstantDelegate: () => InstantX.epoch,
  );
  final customTime = customClock.getCurrentInstant();
  print('カスタム時刻: $customTime');
}

Additional information #

このパッケージはtime_machineパッケージをベースにしている。より詳細な時刻処理が必要な場合は、time_machineパッケージのドキュメントを参照してください。

問題や改善提案がある場合は、GitHub Issuesでお知らせください。

0
likes
125
points
123
downloads

Publisher

unverified uploader

Weekly Downloads

Light-Weight Time libraries wrapper.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, time_machine

More

Packages that depend on armyknife_time