When I attempt to use Blazored.LocalStorage in my code library it never gets init'd and I can't seem to find a way to make that happen.
I know I'm missing something obvious here. To wit:
In MauiProgram.cs:
builder.Services.AddBlazoredLocalStorageAsSingleton();
In my library file:
using Blazored.LocalStorage;
...
public class MyLibrary
{
[Inject]
private static ILocalStorageService LocalStorage { get; set; } // <-- obviously, not getting initialized
public async static Task<string> GetLocalStorageAsync(string key)
{
string rtn = "";
if (LocalStorage != null) // <-- always null
{
if (await LocalStorage.ContainKeyAsync(key))
{
rtn = await LocalStorage.GetItemAsStringAsync(key);
}
}
return rtn;
}
// ...
}
Is it possible to initialize an injected service?
Thanks in advance!