BurkusCat / Burkus.Mvvm.Maui

A simple MVVM framework for .NET MAUI. It provides: navigation, lifecycle events, parameter passing, native dialog abstractions, and testability.
MIT License
27 stars 5 forks source link

[Feature] Required navigation parameters #60

Open BurkusCat opened 4 months ago

BurkusCat commented 4 months ago

Is your feature request related to a problem? Please describe. A page that is being navigated to may require certain parameters to function properly. If these parameters are not passed, the page may not work well.

Describe the solution you'd like A way to mark certain navigation parameters as mandatory/required when navigating to a page. If not present, they should throw an exception to alert the developer that the navigation hasn't been done correctly.

Describe alternatives you've considered N/A

Proposed APIs If possible, try to propose how the API might look. For example:

// Above a viewmodel
[MapNavigationParameter(nameof(ShowLabel), NavigationParameterKeys.ShowLabel, true)] // required

[MapNavigationParameter(nameof(Abc), NavigationParameterKeys.Abc, required: true)] // required

[MapNavigationParameter(nameof(LabelText), NavigationParameterKeys.LabelText, false)] // not required

[MapNavigationParameter(nameof(Xyz), NavigationParameterKeys.Xyz)] // not required

Additional context N/A