dizzbase_client 0.0.1
dizzbase_client: ^0.0.1 copied to clipboard
Flutter client for the dizzbase node.js realtime database backend.
dizzbase Flutter client #
dizzbase is a realtime postgreSQL backend-as-a-service for node.js express servers. Clients (flutter/dart or JavaScript/React) can send query that are automatically updated in realtime.
dizzbase can be an alternative to self-hosting supabase if a lightweight and easy to install solution is needed. Also, it can be used instead of firebase if you need a relational rather than document database.
This package is the dart/flutter client for dizzbase - see https://www.npmjs.com/package/dizzbase for instruction on how to install/run the node.js backend with PostgreSQL.
Features #
Provides a real-time feed to database queries via a dart Stream. Using a flutter StreamBuilder the widget content is automatically updated whenever the data in the database changes. The flutter/dart client also provides interface to update/insert/delete postgresql data and to directly send SQL statments.
Getting started #
Install and configure dizzbase on your backend server: https://www.npmjs.com/package/dizzbase
In the flutter apps main() function, call DizzbaseConnection.configureConnection(...) to configure your backend services URL and access token.
To understand how the dart/flutter dizzbase client works, look at dizzbase_demo_widget.dart first - there you can see how data is retrieved from the database.
In dizzbase_demo_ui.dart there are more widgets that demonstrate how to insert/update/delete data. There is also an example on how to directly send SQL to the backend an retrieve the result (without using a stream).
Note the initState() and dispose() overrides of the StatefulWidgets to see how to create and clean up the dizzbase connection and therefore to avoid backend memory leaks with long-running clients.
To build a small demo app, you can flutter create myApp and then add the initialization code to your main() function:
void main() {
runApp(const MyApp());
DizzbaseConnection.configureConnection("http://localhost:3000", "my-security-token");
}
Then set the DizzbaseDemoWidget as the body of your app:
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: DizzbaseDemoWidget(),
);
}
}
Usage #
Please refer to the demo widgets for details on how to use the client.
Additional information #
A JavaScript/React client might be available in the future.
TO DO #
Backend security (access token) is not yet implemented.