first commit
This commit is contained in:
22
lib/core/config/supabase_config.dart
Normal file
22
lib/core/config/supabase_config.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
|
||||
class SupabaseConfig {
|
||||
const SupabaseConfig._();
|
||||
|
||||
static const _url = String.fromEnvironment('SUPABASE_URL');
|
||||
static const _anonKey = String.fromEnvironment('SUPABASE_ANON_KEY');
|
||||
|
||||
static Future<void> initialize() async {
|
||||
if (_url.isEmpty || _anonKey.isEmpty) {
|
||||
throw StateError(
|
||||
'Missing Supabase env values. Provide SUPABASE_URL and SUPABASE_ANON_KEY '
|
||||
'using --dart-define.',
|
||||
);
|
||||
}
|
||||
|
||||
await Supabase.initialize(
|
||||
url: _url,
|
||||
anonKey: _anonKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user