LuckyInvalidationMonitor constructor

LuckyInvalidationMonitor(
  1. String game, {
  2. DateTime now()?,
})

实验性(可能调整):标记玩法 game;now 默认取系统时间,可注入测试时钟。

例如 LuckyInvalidationMonitor('lots').recordInvalidation();关闭 assert 后不计数。

Implementation

LuckyInvalidationMonitor(String game, {DateTime Function()? now}) {
  assert(() {
    _game = game;
    _now = now ?? DateTime.now;
    _timestamps = [];
    return true;
  }());
}