diff --git a/lib/src/graph.dart b/lib/src/graph.dart index fed40e7..11fad58 100644 --- a/lib/src/graph.dart +++ b/lib/src/graph.dart @@ -70,11 +70,8 @@ enum OkfGraphResolution { const OkfGraphResolution(this.wireValue); - /// Stable JSON representation. - final String wireValue; - /// Parses the stable JSON representation. - static OkfGraphResolution fromWireValue(String value) { + factory OkfGraphResolution.fromWireValue(String value) { for (final resolution in values) { if (resolution.wireValue == value) { return resolution; @@ -82,6 +79,9 @@ enum OkfGraphResolution { } throw FormatException('Unknown graph resolution', value); } + + /// Stable JSON representation. + final String wireValue; } /// Composable filters for constructing an [OkfGraph]. diff --git a/lib/src/metadata.dart b/lib/src/metadata.dart index 60e01c0..75e3769 100644 --- a/lib/src/metadata.dart +++ b/lib/src/metadata.dart @@ -55,10 +55,7 @@ enum OkfLifecycleStatus { const OkfLifecycleStatus(this.wireValue); - /// The stable lowercase representation. - final String wireValue; - - static OkfLifecycleStatus _parse(String? value) { + factory OkfLifecycleStatus._parse(String? value) { switch (value?.trim().toLowerCase()) { case null: case '': @@ -72,6 +69,9 @@ enum OkfLifecycleStatus { return unknown; } } + + /// The stable lowercase representation. + final String wireValue; } /// A date range framing one or more source usage counts.