Flutter / Dart
Use Pulsabase in Flutter with the native Dart SDK.
Installation
Section titled “Installation”dependencies: pulsabase: ^1.0.0flutter pub getimport 'package:pulsabase/pulsabase.dart';
final pb = PulsaClient( url: 'https://api.yourproject.pulsabase.io', clientKey: 'your-public-client-key',);Queries
Section titled “Queries”// Fetch all usersfinal users = await pb.from('users').find();
// Filtered queryfinal adults = await pb.from('users') .where('age', gte(18)) .orderBy('name', ascending: true) .limit(10) .find();
// Insertawait pb.from('users').insert({ 'name': 'Alice', 'email': 'alice@example.com',});
// Updateawait pb.from('users') .where('id', eq(userId)) .update({'name': 'Alice Smith'});
// Deleteawait pb.from('users') .where('id', eq(userId)) .delete();// Sign upawait pb.auth.signUpWithPassword( 'user@example.com', 'securePassword',);
// Sign inawait pb.auth.signInWithPassword( 'user@example.com', 'securePassword',);
// Current userfinal user = await pb.auth.getUser();Realtime
Section titled “Realtime”// Subscribe to table changespb.from('messages') .where('channel_id', eq(channelId)) .subscribe(SubscriptionEvent.insert, (message) { print('New message: $message'); });Storage
Section titled “Storage”// Upload a filefinal file = File('path/to/photo.jpg');await pb.storage.upload( 'user-123/photo.jpg', file.readAsBytesSync(),);
// Get download URLfinal url = await pb.storage.getDownloadUrl('user-123/photo.jpg');