This package provides .NET Multi-platform App UI (MAUI) integration for PowerSync, designed to work with the PowerSync.Common package for cross-platform mobile and desktop applications.
This package is currently in an alpha state, intended strictly for testing. Expect breaking changes and instability as development continues.
Do not rely on this package for production use.
This package is published on NuGet and requires PowerSync.Common to also be installed.
dotnet add package PowerSync.Maui --prerelease
dotnet add package PowerSync.Common --prereleaseInitialization differs slightly from our Common SDK when using MAUI.
private record ListResult(string id, string name, string owner_id, string created_at);
static async Task Main() {
// Ensures the DB file is stored in a platform appropriate location
var dbPath = Path.Combine(FileSystem.AppDataDirectory, "maui-example.db");
var factory = new MAUISQLiteDBOpenFactory(new MDSQLiteOpenFactoryOptions()
{
DbFilename = dbPath
});
var Db = new PowerSyncDatabase(new PowerSyncDatabaseOptions()
{
Database = factory, // Supply a factory
Schema = AppSchema.PowerSyncSchema,
});
await db.Init();
var lists = await db.GetAll<ListResult>("select * from lists");
}