tryFire method
dynamic
tryFire(
{ - List<Bullet> bullets = const [],
})
Implementation
tryFire({List<Bullet> bullets = const []}) {
final key = Duration(milliseconds: timeline).inMinutes;
final exists = value.bullets._map.containsKey(key);
if (exists || bullets.isNotEmpty) {
List<Bullet> toBePrecessed = value.bullets._map[key]
?.where((barrage) =>
barrage.showTime > value.showedTimeBefore &&
barrage.showTime <= timeline)
.toList() ??
[];
if (toBePrecessed.isNotEmpty || bullets.isNotEmpty) {
value = value.copyWith(
showedTimeBefore: timeline,
waitingList: toBePrecessed..addAll(bullets),
processedSize: toBePrecessed.length);
}
}
}