feat(plugins): support enum settings - #667
Conversation
tadelv
left a comment
There was a problem hiding this comment.
Two changes requested before merge:
-
enumvalidation currently exists only inPluginsSettingsView.PluginLoaderService._validateSettings()only checks whether a key exists, so callers outside this UI can still persist arbitrary values for an enum setting. Since this PR introducesenumas a plugin setting type, please move/share enum-value parsing at the settings-schema/service layer and reject non-null values outside the declared enum. The UI should consume the same parsed values so the two paths cannot drift. -
Since this defines the manifest contract, please use a JSON array for
values(for example"values": ["Light", "Medium", "Dark"]) rather than a pipe-delimited string. The array is structurally valid JSON, avoids delimiter/escaping concerns, and is substantially easier to validate consistently.
The rest of the implementation looks good, including stale-value handling and preserving untouched defaults.
Summary
What changed, and why?
enumwith a select control.valuesas a JSON array of strings and share one parser between manifest loading, service validation, and the settings UI.PluginLoaderService, including non-UI callers.Linked Issue
Fixes #255
Verification
How did you verify the change? Include relevant tests and any manual or hardware testing.
flutter test --no-pub test/plugin_loader_service_appstore_test.dart test/plugins_settings_view_appstore_test.dart(42 passed)flutter analyze --no-pub(no issues)flutter test --no-pub(3,220 passed, 1 skipped; the known Windows CRLF-sensitive AsyncAPI schema assertion failed, while CI/Linux uses LF)Impact
Note any user-visible behavior, compatibility, migration, API/spec, documentation, or security impact. Write
Noneif there is none.enumsettings as a fixed-choice selector. Enum manifests use JSON string arrays, and invalid values are rejected at the service boundary. No migration or security impact.Contributor Responsibility
AI-assisted development is allowed. The submitter remains responsible for the submitted work.