23 lines
572 B
Dart
23 lines
572 B
Dart
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,
|
|
);
|
|
}
|
|
}
|