Skip to content

Instantly share code, notes, and snippets.

@nextdev1111
Created July 24, 2022 04:10
Show Gist options
  • Save nextdev1111/266e3524bd3704ac9ce61c7dfd2e6416 to your computer and use it in GitHub Desktop.
Save nextdev1111/266e3524bd3704ac9ce61c7dfd2e6416 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_supabase_yt_1/screens/screens.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// load env
await dotenv.load();
// initialise the app
String supabaseBaseUrl = dotenv.env['SUPABASE_BASE_URL'] ?? '';
String supabaseBaseKey = dotenv.env['SUPABASE_BASE_KEY'] ?? '';
await Supabase.initialize(url: supabaseBaseUrl, anonKey: supabaseBaseKey);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
// you can place here CreateScreen() for viewing the create_screen screen
home: const ReadScreen(),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment