Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: update latest supabase(dart), supabase-flutter packages

phamhieuf55ed5fdeb6a
diff --git a/examples/flutter-user-management/README.md b/examples/flutter-user-management/README.md
index c671ca4900b..7f8a295afff 100644
--- a/examples/flutter-user-management/README.md
+++ b/examples/flutter-user-management/README.md
@@ -50,7 +50,7 @@ Go to the Authentication Settings page (the user icon). Enter the flutter app re
This project uses very high-level Authorization using Postgres' Role Level Security.
When you start a Postgres database on Supabase, we populate it with an `auth` schema, and some helper functions.
-When a user logs in, they are issued a JWT with the role `authenticated` and their UUID.
+When a user logs in, they are issued a JWT with the role `authenticated` and thier UUID.
We can use these details to provide fine-grained control over what each user can and cannot do.
This is a trimmed-down schema, with the policies:
diff --git a/examples/flutter-user-management/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/flutter-user-management/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
index e882ab98894..d36b1fab2d9 100644
--- a/examples/flutter-user-management/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ b/examples/flutter-user-management/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -1,122 +1,122 @@
{
- "images": [
+ "images" : [
{
- "size": "20x20",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "20x20",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "3x"
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "3x"
},
{
- "size": "29x29",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "1x"
},
{
- "size": "29x29",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "29x29",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "3x"
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "3x"
},
{
- "size": "40x40",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "40x40",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "3x"
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "3x"
},
{
- "size": "60x60",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "60x60",
- "idiom": "iphone",
- "filename": "[email protected]",
- "scale": "3x"
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "[email protected]",
+ "scale" : "3x"
},
{
- "size": "20x20",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "1x"
},
{
- "size": "20x20",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "29x29",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "1x"
},
{
- "size": "29x29",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "40x40",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "1x"
},
{
- "size": "40x40",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "76x76",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "1x"
},
{
- "size": "76x76",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "83.5x83.5",
- "idiom": "ipad",
- "filename": "[email protected]",
- "scale": "2x"
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "size": "1024x1024",
- "idiom": "ios-marketing",
- "filename": "[email protected]",
- "scale": "1x"
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "[email protected]",
+ "scale" : "1x"
}
],
- "info": {
- "version": 1,
- "author": "xcode"
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
}
}
diff --git a/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
index 781d7cdcac0..0bedcf2fd46 100644
--- a/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
+++ b/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -1,23 +1,23 @@
{
- "images": [
+ "images" : [
{
- "idiom": "universal",
- "filename": "LaunchImage.png",
- "scale": "1x"
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
},
{
- "idiom": "universal",
- "filename": "[email protected]",
- "scale": "2x"
+ "idiom" : "universal",
+ "filename" : "[email protected]",
+ "scale" : "2x"
},
{
- "idiom": "universal",
- "filename": "[email protected]",
- "scale": "3x"
+ "idiom" : "universal",
+ "filename" : "[email protected]",
+ "scale" : "3x"
}
],
- "info": {
- "version": 1,
- "author": "xcode"
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
}
}
diff --git a/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
index b5b843ad3b8..89c2725b70f 100644
--- a/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
+++ b/examples/flutter-user-management/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -2,4 +2,4 @@
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
-You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/examples/flutter-user-management/lib/configure_nonweb.dart b/examples/flutter-user-management/lib/configure_nonweb.dart
index 71c38d8c869..b1a297dcd8f 100644
--- a/examples/flutter-user-management/lib/configure_nonweb.dart
+++ b/examples/flutter-user-management/lib/configure_nonweb.dart
@@ -3,32 +3,37 @@ import 'package:supabase_flutter/supabase_flutter.dart';
import 'utils/constants.dart';
-void configureApp() {
- // user flutter_secure_storage to persist user session
- final localStorage = LocalStorage(hasAccessToken: () {
- print('Use FlutterSecureStorage hasAccessToken');
- const storage = FlutterSecureStorage();
- return storage.containsKey(key: supabasePersistSessionKey);
- }, accessToken: () {
- print('Use FlutterSecureStorage accessToken');
- const storage = FlutterSecureStorage();
- return storage.read(key: supabasePersistSessionKey);
- }, removePersistedSession: () {
- print('Use FlutterSecureStorage removePersistedSession');
- const storage = FlutterSecureStorage();
- return storage.delete(key: supabasePersistSessionKey);
- }, persistSession: (String value) {
- print('Use FlutterSecureStorage persistSession');
- const storage = FlutterSecureStorage();
- return storage.write(key: supabasePersistSessionKey, value: value);
- });
- print('configureApp for Android, iOS');
+Future configureApp() async {
// init Supabase singleton
- Supabase.initialize(
+ await Supabase.initialize(
url: supabaseUrl,
anonKey: supabaseAnnonKey,
authCallbackUrlHostname: 'login-callback',
debug: true,
- localStorage: localStorage,
+ localStorage: SecureLocalStorage(),
);
}
+
+// user flutter_secure_storage to persist user session
+class SecureLocalStorage extends LocalStorage {
+ SecureLocalStorage()
+ : super(
+ initialize: () async {},
+ hasAccessToken: () {
+ const storage = FlutterSecureStorage();
+ return storage.containsKey(key: supabasePersistSessionKey);
+ },
+ accessToken: () {
+ const storage = FlutterSecureStorage();
+ return storage.read(key: supabasePersistSessionKey);
+ },
+ removePersistedSession: () {
+ const storage = FlutterSecureStorage();
+ return storage.delete(key: supabasePersistSessionKey);
+ },
+ persistSession: (String value) {
+ const storage = FlutterSecureStorage();
+ return storage.write(key: supabasePersistSessionKey, value: value);
+ },
+ );
+}
diff --git a/examples/flutter-user-management/lib/configure_web.dart b/examples/flutter-user-management/lib/configure_web.dart
index cdd435fdfaf..5a9d8e7a375 100644
--- a/examples/flutter-user-management/lib/configure_web.dart
+++ b/examples/flutter-user-management/lib/configure_web.dart
@@ -2,10 +2,10 @@ import 'package:supabase_flutter/supabase_flutter.dart';
import 'utils/constants.dart';
-void configureApp() {
+Future configureApp() async {
// init Supabase singleton
- // no localStorage provided, fallback to use shared_preferences
- Supabase.initialize(
+ // no localStorage provided, fallback to use hive as default
+ await Supabase.initialize(
url: supabaseUrl,
anonKey: supabaseAnnonKey,
authCallbackUrlHostname: 'login-callback',
diff --git a/examples/flutter-user-management/lib/generated_plugin_registrant.dart b/examples/flutter-user-management/lib/generated_plugin_registrant.dart
index b10a8885105..806612ec363 100644
--- a/examples/flutter-user-management/lib/generated_plugin_registrant.dart
+++ b/examples/flutter-user-management/lib/generated_plugin_registrant.dart
@@ -5,7 +5,6 @@
// ignore_for_file: lines_longer_than_80_chars
import 'package:image_picker_for_web/image_picker_for_web.dart';
-import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:uni_links_web/uni_links_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
@@ -14,7 +13,6 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
ImagePickerPlugin.registerWith(registrar);
- SharedPreferencesPlugin.registerWith(registrar);
UniLinksPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
registrar.registerMessageHandler();
diff --git a/examples/flutter-user-management/lib/main.dart b/examples/flutter-user-management/lib/main.dart
index 7640aa16dda..c9b7e28953a 100644
--- a/examples/flutter-user-management/lib/main.dart
+++ b/examples/flutter-user-management/lib/main.dart
@@ -7,9 +7,9 @@ import 'screens/signin_screen.dart';
import 'screens/splash_screen.dart';
import 'screens/web_home_screen.dart';
-void main() {
+Future main() async {
WidgetsFlutterBinding.ensureInitialized();
- configureApp();
+ await configureApp();
runApp(MyApp());
}
diff --git a/examples/flutter-user-management/lib/screens/web_home_screen.dart b/examples/flutter-user-management/lib/screens/web_home_screen.dart
index cc9554a2bf9..af9f0715820 100644
--- a/examples/flutter-user-management/lib/screens/web_home_screen.dart
+++ b/examples/flutter-user-management/lib/screens/web_home_screen.dart
@@ -17,7 +17,7 @@ class _WebHomeScreenState extends AuthState<WebHomeScreen>
void initState() {
super.initState();
- final uriParameters = Supabase.instance.parseUriParameters(Uri.base);
+ final uriParameters = SupabaseAuth.instance.parseUriParameters(Uri.base);
if (uriParameters.containsKey('access_token') &&
uriParameters.containsKey('refresh_token') &&
uriParameters.containsKey('expires_in')) {
@@ -28,7 +28,7 @@ class _WebHomeScreenState extends AuthState<WebHomeScreen>
}
Future onSignIn() async {
- final hasAccessToken = await Supabase.instance.hasAccessToken;
+ final hasAccessToken = await SupabaseAuth.instance.hasAccessToken;
final String route = hasAccessToken ? '/profile' : '/signIn';
stopAuthObserver();
diff --git a/examples/flutter-user-management/pubspec.lock b/examples/flutter-user-management/pubspec.lock
index 1d6e1ca5b94..d154b66af4c 100644
--- a/examples/flutter-user-management/pubspec.lock
+++ b/examples/flutter-user-management/pubspec.lock
@@ -141,7 +141,21 @@ packages:
name: gotrue
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.7"
+ version: "0.1.0"
+ hive:
+ dependency: transitive
+ description:
+ name: hive
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.4"
+ hive_flutter:
+ dependency: transitive
+ description:
+ name: hive_flutter
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
http:
dependency: transitive
description:
@@ -233,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
+ path_provider:
+ dependency: transitive
+ description:
+ name: path_provider
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.3"
path_provider_linux:
dependency: transitive
description:
@@ -240,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
+ path_provider_macos:
+ dependency: transitive
+ description:
+ name: path_provider_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.2"
path_provider_platform_interface:
dependency: transitive
description:
@@ -288,7 +316,7 @@ packages:
name: postgrest
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.1.6"
process:
dependency: transitive
description:
@@ -302,7 +330,7 @@ packages:
name: realtime_client
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3"
+ version: "0.1.10"
rounded_loading_button:
dependency: "direct main"
description:
@@ -317,48 +345,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.26.0"
- shared_preferences:
- dependency: transitive
- description:
- name: shared_preferences
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.6"
- shared_preferences_linux:
- dependency: transitive
- description:
- name: shared_preferences_linux
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
- shared_preferences_macos:
- dependency: transitive
- description:
- name: shared_preferences_macos
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
- shared_preferences_platform_interface:
- dependency: transitive
- description:
- name: shared_preferences_platform_interface
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
- shared_preferences_web:
- dependency: transitive
- description:
- name: shared_preferences_web
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
- shared_preferences_windows:
- dependency: transitive
- description:
- name: shared_preferences_windows
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
@@ -384,7 +370,7 @@ packages:
name: storage_client
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.3"
+ version: "0.0.4"
stream_channel:
dependency: transitive
description:
@@ -405,14 +391,14 @@ packages:
name: supabase
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.3"
+ version: "0.2.5"
supabase_flutter:
dependency: "direct main"
description:
name: supabase_flutter
url: "https://pub.dartlang.org"
source: hosted
- version: "0.0.4"
+ version: "0.2.6"
term_glyph:
dependency: transitive
description:
diff --git a/examples/flutter-user-management/pubspec.yaml b/examples/flutter-user-management/pubspec.yaml
index c579f03e150..9490ca7ca35 100644
--- a/examples/flutter-user-management/pubspec.yaml
+++ b/examples/flutter-user-management/pubspec.yaml
@@ -27,8 +27,8 @@ dependencies:
flutter_secure_storage: ^4.2.0
image_picker: ^0.8.2
rounded_loading_button: ^2.0.5
- supabase: ^0.0.3
- supabase_flutter: ^0.0.4
+ supabase: ^0.2.5
+ supabase_flutter: ^0.2.6
dev_dependencies:
flutter_launcher_icons: ^0.9.0
diff --git a/examples/flutter-user-management/web/manifest.json b/examples/flutter-user-management/web/manifest.json
index b9ca8e96a4f..e850c7df0a5 100644
--- a/examples/flutter-user-management/web/manifest.json
+++ b/examples/flutter-user-management/web/manifest.json
@@ -1,23 +1,23 @@
{
- "name": "supabase_demo",
- "short_name": "supabase_demo",
- "start_url": ".",
- "display": "standalone",
- "background_color": "#0175C2",
- "theme_color": "#0175C2",
- "description": "A new Flutter project.",
- "orientation": "portrait-primary",
- "prefer_related_applications": false,
- "icons": [
- {
- "src": "icons/Icon-192.png",
- "sizes": "192x192",
- "type": "image/png"
- },
- {
- "src": "icons/Icon-512.png",
- "sizes": "512x512",
- "type": "image/png"
- }
- ]
+ "name": "supabase_demo",
+ "short_name": "supabase_demo",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ]
}