[Feature] SecureStorage.GetOrSetAsync(key, value?)
#27966
Labels
area-essentials
Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info
essentials-secure-storage
proposal/open
t/enhancement ☀️
New feature or request
Milestone
Description
An interesting way to get values would be
GetOrSetAsync
, like we have inIMemoryCache
from ASP.NET, currently, this functionality could also be chained in a task array to properly setup values in function likeOnInitializedAsync
from blazor (using hybrid), like the example:That would be a pretty cool advantage over:
Public API Changes
Internally example application (could be used as an extension):
This implementation could be improved by changing the internal default
SecureStorageImplementation
to automatically support that method by creating the nativePlatformGetOrSetAsync
binding to programatically execute the operations closer to the providers.Intended Use-Case
Currently, this situation can be achieved by the creation of a helper method, or even an external library that can be used across codebases. I believe that with the correct implementation across native platforms, this functionality can grant atomicity to specific process, ease the internal development process for the final user (such as the example I mentioned where it could be easily used with
Task.WhenAll
.The real motivation besides the real improvements that the function can bring, was the open minded situation where the MAUI project stills right now - that I found by reading some proposal issues along the time, like the one where I found the following comment, I am even inclinated to contribute myself to make these things happen as possible.
The text was updated successfully, but these errors were encountered: