The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: connect flutter example (#22693)
hallidayo6105e610a80f
diff --git a/apps/studio/components/interfaces/Home/Connect/Connect.constants.ts b/apps/studio/components/interfaces/Home/Connect/Connect.constants.tsindex 7293d31270b..9814e1e6dfe 100644--- a/apps/studio/components/interfaces/Home/Connect/Connect.constants.ts+++ b/apps/studio/components/interfaces/Home/Connect/Connect.constants.ts@@ -169,6 +169,20 @@ export const FRAMEWORKS: ConnectionType[] = [},],},+ {+ key: 'flutter',+ label: 'Flutter',+ icon: 'flutter',+ guideLink: 'https://supabase.com/docs/guides/getting-started/tutorials/with-flutter',+ children: [+ {+ key: 'supabaseflutter',+ label: 'supabase-flutter',+ children: [],+ icon: 'supabase',+ },+ ],+ },]export const ORMS: ConnectionType[] = [diff --git a/apps/studio/components/interfaces/Home/Connect/content/flutter/supabaseflutter/content.tsx b/apps/studio/components/interfaces/Home/Connect/content/flutter/supabaseflutter/content.tsxnew file mode 100644index 00000000000..16358840cfb--- /dev/null+++ b/apps/studio/components/interfaces/Home/Connect/content/flutter/supabaseflutter/content.tsx@@ -0,0 +1,93 @@+import type { ContentFileProps } from 'components/interfaces/Home/Connect/Connect.types'++import {+ ConnectTabs,+ ConnectTabTriggers,+ ConnectTabTrigger,+ ConnectTabContent,+} from 'components/interfaces/Home/Connect/ConnectTabs'+import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'++const ContentFile = ({ projectKeys }: ContentFileProps) => {+ return (+ <ConnectTabs>+ <ConnectTabTriggers>+ <ConnectTabTrigger value="lib/main.dart" />+ <ConnectTabTrigger value="lib/main.dart (app)" />+ </ConnectTabTriggers>++ <ConnectTabContent value="lib/main.dart">+ <SimpleCodeBlock className="dart" parentClassName="min-h-72">+ {`+import 'package:supabase_flutter/supabase_flutter.dart';++Future<void> main() async {+ await Supabase.initialize(+ url: ${projectKeys.apiUrl ?? 'your-project-url'},+ anonKey: ${projectKeys.anonKey ?? 'your-anon-key'},+ );+ runApp(MyApp());+}+ `}+ </SimpleCodeBlock>+ </ConnectTabContent>++ <ConnectTabContent value="lib/main.dart (app)">+ <SimpleCodeBlock className="dart" parentClassName="min-h-72">+ {`+class MyApp extends StatelessWidget {+ const MyApp({super.key});++ @override+ Widget build(BuildContext context) {+ return const MaterialApp(+ title: 'Todos',+ home: HomePage(),+ );+ }+}++class HomePage extends StatefulWidget {+ const HomePage({super.key});++ @override+ State<HomePage> createState() => _HomePageState();+}++class _HomePageState extends State<HomePage> {+ final _future = Supabase.instance.client+ .from('todos')+ .select();++ @override+ Widget build(BuildContext context) {+ return Scaffold(+ body: FutureBuilder(+ future: _future,+ builder: (context, snapshot) {+ if (!snapshot.hasData) {+ return const Center(child: CircularProgressIndicator());+ }+ final todos = snapshot.data!;+ return ListView.builder(+ itemCount: todos.length,+ itemBuilder: ((context, index) {+ final todo = todos[index];+ return ListTile(+ title: Text(todo['name']),+ );+ }),+ );+ },+ ),+ );+ }+}+`}+ </SimpleCodeBlock>+ </ConnectTabContent>+ </ConnectTabs>+ )+}++export default ContentFile