EXERLOG / exer_log

exer_log - authored by @KalleHallden

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

initial run errors - FirebaseOptions

mfederowicz opened this issue · comments

I wanted run this application for the first time, so I installed flutter from https://docs.flutter.dev/get-started/install/linux, next run all steps from Development section, then run:

flutter run                                                                                                                                                               
Launching lib/main.dart on Chrome in debug mode...                                                                                                                           
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_riverpod-1.0.3/lib/src/framework.dart:275:26: Warning: Operand of null-aware operation '!' has  
type 'SchedulerBinding' which excludes null.                                                                                                                                 
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../snap/flutter/common/flutter/packages/flutter/lib/src/scheduler/binding.dart').            
    if (SchedulerBinding.instance!.schedulerPhase ==                                                                                                                         
                         ^

of course Chrome with debug mode started, but stopped with error on console:

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────                                                     
│ #0   packages/exerlog/src/utils/logger/logger.dart 29:58                  info                                                                                             
│ #1   packages/exerlog/src/utils/logger/riverpod_logger.dart 13:9          didUpdateProvider                                                                                
├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄                                                     
│ 💡 {                                                                                                                                                                       
│ 💡   "provider": "FutureProvider<FirebaseApp>",                                                                                                                            
│ 💡   "newValue": "AsyncError<FirebaseApp>(error: Assertion failed:                                                                                                         
file:///home/developer/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.1/lib/src/firebase_core_web.dart:207:11                        
│ 💡 options != null                                                                                                                                                         
│ 💡 "FirebaseOptions cannot be null when creating the default app.", stackTrace: dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49  throw_       
│ 💡 dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3    assertFailed                                                                              
│ 💡 packages/firebase_core_web/src/firebase_core_web.dart 207:18                  initializeApp                                                                             
│ 💡 dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>                                                                                      
│ 💡 dart-sdk/lib/async/zone.dart 1685:54                                          runUnary                                                                                  
│ 💡 dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue                                                                               
│ 💡 dart-sdk/lib/async/future_impl.dart 766:44                                    handleValueCallback                                                                       
│ 💡 dart-sdk/lib/async/future_impl.dart 795:13                                    _propagateToListeners                                                                     
│ 💡 dart-sdk/lib/async/future_impl.dart 566:5                                     [_completeWithValue]                                                                      
│ 💡 dart-sdk/lib/async/future.dart 527:22                                         <fn>                                                                                      
│ 💡 dart-sdk/lib/async/zone.dart 1685:54                                          runUnary                                                                                  
│ 💡 dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue                                                                               
│ 💡 dart-sdk/lib/async/future_impl.dart 766:44                                    handleValueCallback                                                                       
│ 💡 dart-sdk/lib/async/future_impl.dart 795:13                                    _propagateToListeners                                                                     
│ 💡 dart-sdk/lib/async/future_impl.dart 566:5                                     [_completeWithValue]
│ 💡 dart-sdk/lib/async/future_impl.dart 639:7                                     callback
│ 💡 dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
│ 💡 dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
│ 💡 dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>
│ 💡 )"
│ 💡 }
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following TypeErrorImpl was thrown building MyApp(dirty, dependencies:
[UncontrolledProviderScope], state: _ConsumerState#c34bc):
Expected a value of type 'String?', but got one of type 'AssertionErrorImpl'

The relevant error-causing widget was:
  MyApp MyApp:file:///home/developer/git-repos/exer_log/lib/main.dart:44:14

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49      throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 84:3        castError
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 452:10  cast 
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart 367:9        as
packages/exerlog/main.dart 87:15                                                  <fn> 
packages/riverpod/src/common.dart 265:26                                          <fn> 
packages/riverpod/src/common.dart 391:17                                          [_map]
packages/riverpod/src/common.dart 263:12                                          AsyncValueX.when
packages/exerlog/main.dart 62:22                                                  build
packages/flutter_riverpod/src/consumer.dart 371:19                                build
packages/flutter/src/widgets/framework.dart 4919:27                               build
packages/flutter_riverpod/src/consumer.dart 431:20                                build
packages/flutter/src/widgets/framework.dart 4806:15                               performRebuild
packages/flutter/src/widgets/framework.dart 4977:11                               performRebuild
packages/flutter/src/widgets/framework.dart 4529:5                                rebuild
packages/flutter/src/widgets/framework.dart 2659:18                               buildScope
packages/flutter/src/widgets/binding.dart 891:9                                   drawFrame
packages/flutter/src/rendering/binding.dart 370:5                                 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1146:15                               [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1083:9                                handleDrawFrame
packages/flutter/src/scheduler/binding.dart 997:5                                 [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1090:13                               invoke
lib/_engine/engine/platform_dispatcher.dart 160:5                                 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 194:45                                     <fn> 

════════════════════════════════════════════════════════════════════════════════════════════════════
Application finished.

of course this is my first run, and maybe I should install some additional libs (or make additional config) to avoid these errors

I found some article connected with initialization of firebase in app, maybe it will help: https://fluttercorner.com/firebaseoptions-cannot-be-null-when-creating-the-default-app/

Im pretty sure this is just because you ran it in chrome. The app currently isn’t optimised for web, only iOS and android. Can you try again on one of these platforms?

Ok I finished flutter configuration:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS 5.14.0-1047-oem, locale en_IN.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Android Studio (version 2021.2)
[✓] VS Code
[✓] Connected device (1 available)
[✓] HTTP Host Availability

• No issues found!

and after launch selected android emulator, application stared:

flutter run                                                                                                                                                               
Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".   
Launching lib/main.dart on Android SDK built for x86 in debug mode...                                                                                                        
Running Gradle task 'assembleDebug'...                              9.0s                                                                                                     
✓  Built build/app/outputs/flutter-apk/app-debug.apk.                                                                                                                        
W/FlutterActivityAndFragmentDelegate( 4420): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps
.                                                                                                                                                                            
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_riverpod-1.0.3/lib/src/framework.dart:275:26: Warning: Operand of null-aware operation '!' has  
type 'SchedulerBinding' which excludes null.                                                                                                                                 
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../snap/flutter/common/flutter/packages/flutter/lib/src/scheduler/binding.dart').            
    if (SchedulerBinding.instance!.schedulerPhase ==                                                                                                                         
                         ^                                                                                                                                                   
Syncing files to device Android SDK built for x86...               370ms                                                                                                     
                                                                                                                                                                             
Flutter run key commands.                                                                                                                                                    
r Hot reload. 🔥🔥🔥                                                                                                                                                         
R Hot restart.                                                                                                                                                               
h List all available interactive commands.                                                                                                                                   
d Detach (terminate "flutter run" but leave application running).                                                                                                            
c Clear the screen                                                                                                                                                           
q Quit (terminate the application on the device).                                                                                                                            

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Maybe it will be good idea to add tip in Development section about iOS and Android compatibility

@mfederowicz we can close this issue right?

CC: @KalleHallden