newAction function

Action newAction({
  1. required String name,
  2. required Random prng,
  3. String? note,
})

Implementation

pb.Action newAction({required String name, required math.Random prng, String? note}) {
  assert(name != null);
  var action = pb.Action();
  action.ensureCommon().ensureMetadata().name = name;
  if (note != null && note.isNotEmpty) {
    action.ensureCommon().ensureMetadata().note = note;
  }
  var ts = action.common.ensureTimestamp();
  ts.ctime = ts.mtime = now();
  action.common.uid = randomUid(prng);
  return action;
}