Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/dist/
/dist/
dotenv
17 changes: 8 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:cookethflow/core/services/supabase_service.dart';
import 'package:cookethflow/providers/dashboard_provider.dart';
import 'package:cookethflow/providers/flowmanage_provider.dart';
import 'package:cookethflow/providers/loading_provider.dart';
import 'package:cookethflow/providers/workspace_provider.dart';
Expand All @@ -20,17 +19,19 @@ Future<void> main() async {
String supabaseUrl;
String supabaseApiKey;

// Check if running in a production build (e.g., GitHub Actions) with environment variables
if(kIsWeb || !(Platform.environment.containsKey('SUPABASE_URL') &&
Platform.environment.containsKey('SUPABASE_KEY'))){
// Fallback to .env file for local development
await dotenv.load(fileName: '.env');
if(kIsWeb){
await dotenv.load(fileName: './dotenv');
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
}
else {
else if(Platform.environment.containsKey('SUPABASE_URL') &&
Platform.environment.containsKey('SUPABASE_KEY')) {
supabaseUrl = Platform.environment['SUPABASE_URL']!;
supabaseApiKey = Platform.environment['SUPABASE_KEY']!;
}else{
await dotenv.load(fileName: '.env');
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
}

final instance = await Supabase.initialize(
Expand Down Expand Up @@ -59,8 +60,6 @@ Future<void> main() async {
update: (context, flowManage, previousWorkspace) =>
previousWorkspace ?? WorkspaceProvider(flowManage),
),
ChangeNotifierProvider<DashboardProvider>(
create: (_) => DashboardProvider()),
ChangeNotifierProvider<LoadingProvider>(create: (_) => LoadingProvider()),
],
child: const MyApp(),
Expand Down
5 changes: 0 additions & 5 deletions lib/providers/dashboard_provider.dart

This file was deleted.

1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ flutter:
assets:
- assets/
- .env
- dotenv
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down