We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b030737 commit 5f7cccdCopy full SHA for 5f7cccd
lib/api/model/model.dart
@@ -954,4 +954,15 @@ enum PropagateMode {
954
changeAll;
955
956
String toJson() => _$PropagateModeEnumMap[this]!;
957
+
958
+ /// Get a [PropagateMode] from a raw string. Throws if the string is
959
+ /// unrecognized.
960
+ ///
961
+ /// Example:
962
+ /// 'change_one' -> PropagateMode.changeOne
963
+ static PropagateMode fromRawString(String raw) => _byRawString[raw]!;
964
965
+ // _$…EnumMap is thanks to `alwaysCreate: true` and `fieldRename: FieldRename.snake`
966
+ static final _byRawString = _$PropagateModeEnumMap
967
+ .map((key, value) => MapEntry(value, key));
968
}
0 commit comments