Accessing a native API from Blazor Hybrid apps
When it comes to accessing native APIs, there isn’t a significant difference between .NET MAUI apps and Blazor Hybrid apps. As we learned in Chapter 7, Using Platform-Specific Features, it’s vital to always create an abstract layer that encapsulates native access at the platform layer. Hence, we’re not directly accessing native APIs from cross-platform code in .NET MAUI or Blazor Hybrid apps. In our app, while we do need to access native APIs, we will access a native API through an abstract layer.
Access to platform APIs from .NET has seen significant evolution over time, transitioning from Xamarin plugins to the unified NuGet dependency presented by Xamarin.Essentials. As discussed in Chapter 7, Using Platform-Specific Features, Xamarin.Essentials aimed to standardize all native access within a single library. Initially, the plan with .NET MAUI was to migrate everything as .NET MAUI Essentials. However, the ...