ReactionOperation.fromJson constructor

ReactionOperation.fromJson(
  1. Map map
)

Implementation

factory ReactionOperation.fromJson(Map map) {
  String userId = map["userId"];
  String reaction = map["reaction"];

  ReactionOperate operate = (map["operate"] ?? 0) == 0
      ? ReactionOperate.Remove
      : ReactionOperate.Add;

  return ReactionOperation._private(userId, reaction, operate);
}