The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
removed user database and changed todos db same as nextjs todo example
Aniket Singh40adf2259733
diff --git a/examples/todo-list/flutter-todo-list/lib/screens/signup.dart b/examples/todo-list/flutter-todo-list/lib/screens/signup.dartindex 3459be2a973..0ff98c454e4 100644--- a/examples/todo-list/flutter-todo-list/lib/screens/signup.dart+++ b/examples/todo-list/flutter-todo-list/lib/screens/signup.dart@@ -26,16 +26,6 @@ class _SignUpPageState extends State<SignUpPage> {}}- Future<dynamic> addUser({- required String name,- required String email,- }) async {- final res = await client.from('Users').insert({- 'name': name,- 'email': email,- }).execute();- }-@overrideWidget build(BuildContext context) {return Scaffold(@@ -83,10 +73,6 @@ class _SignUpPageState extends State<SignUpPage> {password: _passwordController.text,);if (value == true) {- addUser(- name: _nameController.text,- email: _emailController.text,- );Navigator.pushReplacementNamed(context, '/signin');}},diff --git a/examples/todo-list/flutter-todo-list/lib/screens/todo.dart b/examples/todo-list/flutter-todo-list/lib/screens/todo.dartindex a4fe121cfcf..253f20fa504 100644--- a/examples/todo-list/flutter-todo-list/lib/screens/todo.dart+++ b/examples/todo-list/flutter-todo-list/lib/screens/todo.dart@@ -9,7 +9,6 @@ class TodoPage extends StatefulWidget {}class _TodoPageState extends State<TodoPage> {- String userName = '';bool loading = true;List<dynamic> todos = [];final TextEditingController _taskEditingController = TextEditingController();@@ -18,20 +17,12 @@ class _TodoPageState extends State<TodoPage> {await client.auth.signOut();}- // GET THE USER DETAILS- Future<dynamic> getUser({required String email}) async {- final res =- await client.from('Users').select().eq('email', email).execute();- final data = res.data;- return data;- }-// GETR THE TODOSFuture<List<dynamic>> getTodo() async {final res = await client- .from('Todo')+ .from('todos').select('*')- .eq('email', client.auth.currentUser!.email.toString())+ .eq('user_id', client.auth.currentUser!.id).order('id').execute();final data = res.data;@@ -43,8 +34,8 @@ class _TodoPageState extends State<TodoPage> {required String task,required String due,}) async {- final res = await client.from('Todo').insert({- 'email': client.auth.currentUser!.email.toString(),+ final res = await client.from('todos').insert({+ 'user_id': client.auth.currentUser!.id,'task': task,'due': due,'done': false@@ -56,7 +47,7 @@ class _TodoPageState extends State<TodoPage> {// DELETE A Todo IN THE DBFuture<void> deleteTodo({required String id}) async {try {- await client.from('Todo').delete().eq('id', id).execute();+ await client.from('todos').delete().eq('id', id).execute();} catch (e) {print(e);}@@ -68,7 +59,7 @@ class _TodoPageState extends State<TodoPage> {required bool value,}) async {final res = await client- .from('Todo')+ .from('todos').update({'done': value}).eq('id', id).execute();@@ -83,7 +74,7 @@ class _TodoPageState extends State<TodoPage> {required String task,}) async {final res = await client- .from('Todo')+ .from('todos').update({'due': due, 'task': task}).eq('id', id).execute();@@ -92,11 +83,6 @@ class _TodoPageState extends State<TodoPage> {}Future<void> initFunc() async {- var nameVal =- await getUser(email: client.auth.currentUser!.email.toString());- setState(() {- userName = nameVal[0]['name'];- });List<dynamic> value = await getTodo();for (var element in value) {todos.add(element);@@ -169,7 +155,7 @@ class _TodoPageState extends State<TodoPage> {appBar: AppBar(backgroundColor: Colors.black,automaticallyImplyLeading: false,- title: Text('Hey $userName, add todo'),+ title: Text('Supabase Todo'),actions: <Widget>[IconButton(icon: const Icon(Icons.exit_to_app),diff --git a/examples/todo-list/flutter-todo-list/pubspec.yaml b/examples/todo-list/flutter-todo-list/pubspec.yamlindex b8f935d94c3..3d4df48cc8d 100644--- a/examples/todo-list/flutter-todo-list/pubspec.yaml+++ b/examples/todo-list/flutter-todo-list/pubspec.yaml@@ -44,7 +44,7 @@ dev_dependencies:# activated in the `analysis_options.yaml` file located at the root of your# package. See that file for information about deactivating specific lint# rules and activating additional ones.- # lints: ^2.0.0+ lints: ^2.0.0# For information on the generic Dart part of this file, see the# following page: https://dart.dev/tools/pub/pubspec