Skip to content

Commit

Permalink
feat: insight - method to get an insight annotation from an int value
Browse files Browse the repository at this point in the history
Impacted file:
* `insight.dart`: implemented the `fromInt` method for `InsightAnnotation`
  • Loading branch information
monsieurtanuki committed Sep 7, 2023
1 parent a26ec2a commit fdf1bcc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/model/insight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ enum InsightAnnotation {
const InsightAnnotation(this.value);

final int value;

static InsightAnnotation? fromInt(final int annotation) {
for (final InsightAnnotation insightAnnotation in values) {
if (insightAnnotation.value == annotation) {
return insightAnnotation;
}
}
return null;
}
}

enum InsightType implements OffTagged {
Expand Down

0 comments on commit fdf1bcc

Please sign in to comment.