You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-45Lines changed: 48 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,8 +47,6 @@ void main() async {
47
47
final supabase = Supabase.instance.client;
48
48
```
49
49
50
-
> `authCallbackUrlHostname` is optional. It will be used to filter Supabase authentication redirect deeplink. You need to provide this param if you use deeplink for other features on the app.
51
-
52
50
> `debug` is optional. It's enabled by default if you're running the app in debug mode (`flutter run --debug`).
53
51
54
52
## Usage example
@@ -173,12 +171,12 @@ class MyWidget extends StatefulWidget {
173
171
174
172
class _MyWidgetState extends State<MyWidget> {
175
173
// Persisting the future as local variable to prevent refetching upon rebuilds.
176
-
final List<Map<String, dynamic>> _stream = supabase.from('countries').stream(primaryKey: ['id']);
174
+
final stream = supabase.from('countries').stream(primaryKey: ['id']);
177
175
178
176
@override
179
177
Widget build(BuildContext context) {
180
178
return StreamBuilder<List<Map<String, dynamic>>>(
181
-
stream: _stream,
179
+
stream: stream,
182
180
builder: (context, snapshot) {
183
181
// return your widget with the data from snapshot
184
182
},
@@ -213,11 +211,13 @@ Broadcast lets you send and receive low latency messages between connected clien
As default, `supabase_flutter` uses [`hive`](https://pub.dev/packages/hive) to persist the user session. Encryption is disabled by default, since an unique encryption key is necessary, and we can not define it. To set an `encryptionKey`, do the following:
341
+
As default, `supabase_flutter` uses [`Shared preferences`](https://pub.dev/packages/shared_preferences) to persist the user session.
342
+
343
+
However, you can use any other methods by creating a `LocalStorage` implementation. For example, we can use [`flutter_secure_storage`](https://pub.dev/packages/flutter_secure_storage) plugin to store the user session in a secure storage.
342
344
343
345
```dart
344
-
Future<void> main() async {
345
-
// set it before initializing
346
-
HiveLocalStorage.encryptionKey = 'my_secure_key';
347
-
await Supabase.initialize(...);
348
-
}
349
-
```
346
+
// Define the custom LocalStorage implementation
347
+
class MockLocalStorage extends LocalStorage {
350
348
351
-
**Note** the key must be the same. There is no check if the encryption key is correct. If it isn't, there may be unexpected behavior. [Learn more](https://docs.hivedb.dev/#/advanced/encrypted_box) about encryption in hive.
349
+
final storage = FlutterSecureStorage();
352
350
353
-
However you can use any other methods by creating a `LocalStorage` implementation. For example, we can use [`flutter_secure_storage`](https://pub.dev/packages/flutter_secure_storage) plugin to store the user session in a secure storage.
0 commit comments