Sentiment.fromJson constructor

Sentiment.fromJson(
  1. Object? j
)

Implementation

factory Sentiment.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Sentiment(
    magnitude: switch (json['magnitude']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    score: switch (json['score']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
  );
}