diff --git a/lib/src/services/deck_repository.dart b/lib/src/services/deck_repository.dart index 3d447ff..cfc22a9 100644 --- a/lib/src/services/deck_repository.dart +++ b/lib/src/services/deck_repository.dart @@ -100,7 +100,15 @@ class DeckRepository { } Future loadApiKey() async { - final envApiKey = dotenv.env['WANIKANI_API_KEY']; + String? envApiKey; + try { + envApiKey = dotenv.env['WANIKANI_API_KEY']; + } catch (e) { + // dotenv is not initialized, so we can't get the key. + // This is expected in release builds. + envApiKey = null; + } + if (envApiKey != null && envApiKey.isNotEmpty) { _apiKey = envApiKey; return _apiKey; @@ -405,4 +413,4 @@ class DeckRepository { await saveVocabulary(items); return items; } -} +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index ad2c70d..9193382 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,5 +34,4 @@ flutter_icons: flutter: uses-material-design: true assets: - - assets/sfx/confirm.mp3 - - .env + - assets/sfx/confirm.mp3 \ No newline at end of file