firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.73k stars 3.98k forks source link

[REMOTE_CONFIG] null check operator used on a null value #13454

Closed pogorv12 closed 1 month ago

pogorv12 commented 1 month ago

Is there an existing issue for this?

Which plugins are affected?

Remote Config

Which platforms are affected?

Web

Description

I get Null check operator error when code compile and run in production mode.

This seems to be exactly the same issue as the https://github.com/firebase/flutterfire/issues/12496. The issue is closed but i didn't get what was the solution.

Reproducing the issue

So, my code is:

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:storetells/firebase_options.dart';

void main() async {
  print("Test1");
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  print("Test2");
  FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.instance;
  print("Test3");
  await remoteConfig.setDefaults({
    "appVersion": "0.0.1",
  });
  print("Test4");
  await remoteConfig.fetchAndActivate();
  print("Test5");
  runApp(const CircularProgressIndicator());
}

When I compile and run it locally with "flutter run" command - it works fine.

When I compele it with "flutter build web --profile --source-maps", upload to hosting using "firebase hosting:channel:deploy test" and then open in browser - it works fine.

But, when i compile it with just "flutter build web", upload to hosting using "firebase hosting:channel:deploy test" and then open in browser - i get NULL CHECK ERROR.

If I remove remoteConfig related lines (sample bellow), "flutter build web" and "firebase hosting:channel:deploy test" works fine.

void main() async {
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  runApp(const CircularProgressIndicator());
}

Firebase Core version

3.1.0

Flutter Version

3.24.3

Relevant Log Output

main.dart.js:9194 Test1
main.dart.js:9194 Test2
main.dart.js:9194 Test3
main.dart.js:2741 Uncaught Error: Null check operator used on a null value
    at eF.nB (main.dart.js:19697:9)
    at en.gmL (main.dart.js:19589:3)
    at main.dart.js:9427:14
    at Eu.a (main.dart.js:3995:63)
    at Eu.$2 (main.dart.js:16619:14)
    at E_.$1 (main.dart.js:16613:21)
    at Dx.BT (main.dart.js:17200:31)
    at Dx.lt (main.dart.js:17203:13)
    at CX.$0 (main.dart.js:16959:11)
    at Object.hf (main.dart.js:4090:39)
c @ main.dart.js:2741
Ny @ main.dart.js:4648
w6 @ main.dart.js:4737
$0 @ main.dart.js:17180
Ro @ main.dart.js:4122
Ry @ main.dart.js:4124
$1 @ main.dart.js:16572
childList
$1 @ main.dart.js:16579
Ks @ main.dart.js:4129
hw @ main.dart.js:4183
un @ main.dart.js:16901
ci @ main.dart.js:16899
eN @ main.dart.js:16820
bm @ main.dart.js:16821
$1 @ main.dart.js:19273
QG @ main.dart.js:5633
(anonymous) @ main.dart.js:5624
(anonymous) @ auth_impl.ts:745
Promise.then
registerStateListener @ auth_impl.ts:744
onAuthStateChanged @ auth_impl.ts:545
(anonymous) @ main.dart.js:19265
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
hY @ main.dart.js:19270
(anonymous) @ main.dart.js:19248
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
qK @ main.dart.js:19250
$1 @ main.dart.js:19230
$1 @ main.dart.js:19562
m @ main.dart.js:15873
ml @ main.dart.js:4029
(anonymous) @ main.dart.js:19517
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
$1 @ main.dart.js:16613
BT @ main.dart.js:17200
lt @ main.dart.js:17203
$0 @ main.dart.js:16959
hf @ main.dart.js:4090
eq @ main.dart.js:16894
eN @ main.dart.js:16608
x @ main.dart.js:3985
(anonymous) @ main.dart.js:19484
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
$1 @ main.dart.js:16613
BT @ main.dart.js:17200
lt @ main.dart.js:17203
$0 @ main.dart.js:16959
hf @ main.dart.js:4090
eq @ main.dart.js:16894
$1 @ main.dart.js:16803
BT @ main.dart.js:17200
lt @ main.dart.js:17203
$0 @ main.dart.js:16959
hf @ main.dart.js:4090
eq @ main.dart.js:16894
eN @ main.dart.js:16608
x @ main.dart.js:3985
(anonymous) @ main.dart.js:19471
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
$1 @ main.dart.js:16613
BT @ main.dart.js:17200
lt @ main.dart.js:17203
$0 @ main.dart.js:16959
hf @ main.dart.js:4090
eq @ main.dart.js:16894
$0 @ main.dart.js:16930
Ro @ main.dart.js:4122
Ry @ main.dart.js:4124
$1 @ main.dart.js:16572
childList
$1 @ main.dart.js:16579
Ks @ main.dart.js:4129
hw @ main.dart.js:4183
un @ main.dart.js:16901
ci @ main.dart.js:16899
eN @ main.dart.js:16820
bm @ main.dart.js:16821
$1 @ main.dart.js:19547
QG @ main.dart.js:5633
(anonymous) @ main.dart.js:5624
window.ff_trigger_firebase_performance @ VM1593:3
await in window.ff_trigger_firebase_performance
O4 @ main.dart.js:9200
Ie @ main.dart.js:9202
(anonymous) @ main.dart.js:19468
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
Az @ main.dart.js:19472
hM @ main.dart.js:19448
$1 @ main.dart.js:19554
m @ main.dart.js:15873
ml @ main.dart.js:4029
(anonymous) @ main.dart.js:19483
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
fF @ main.dart.js:19485
(anonymous) @ main.dart.js:19491
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
Ax @ main.dart.js:19523
bs @ main.dart.js:19486
(anonymous) @ main.dart.js:5920
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
wD @ main.dart.js:5927
(anonymous) @ main.dart.js:9417
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
kB @ main.dart.js:9459
$0 @ main.dart.js:26795
(anonymous) @ main.dart.js:19087
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
$1 @ main.dart.js:16613
BT @ main.dart.js:17200
lt @ main.dart.js:17203
$0 @ main.dart.js:16959
hf @ main.dart.js:4090
eq @ main.dart.js:16894
$0 @ main.dart.js:16930
Ro @ main.dart.js:4122
Ry @ main.dart.js:4124
$1 @ main.dart.js:16572
childList
$1 @ main.dart.js:16579
Ks @ main.dart.js:4129
hw @ main.dart.js:4183
un @ main.dart.js:16901
ci @ main.dart.js:16899
by @ main.dart.js:4009
(anonymous) @ main.dart.js:684
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
GE @ main.dart.js:694
(anonymous) @ main.dart.js:19086
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
$0 @ main.dart.js:19089
(anonymous) @ main.dart.js:9531
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
qH @ main.dart.js:9536
$1 @ main.dart.js:9525
$1 @ main.dart.js:11244
$0 @ main.dart.js:11245
QG @ main.dart.js:5634
(anonymous) @ main.dart.js:5624
(anonymous) @ flutter_bootstrap.js:1
Promise.then
n @ flutter_bootstrap.js:1
didCreateEngineInitializer @ flutter_bootstrap.js:1
(anonymous) @ main.dart.js:5821
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
Ev @ main.dart.js:5823
(anonymous) @ main.dart.js:9181
(anonymous) @ main.dart.js:3995
$2 @ main.dart.js:16619
y @ main.dart.js:3981
F_ @ main.dart.js:9183
(anonymous) @ main.dart.js:29700
(anonymous) @ main.dart.js:29696
dartProgram @ main.dart.js:29698
(anonymous) @ main.dart.js:29700

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Dart SDK 3.5.3 Flutter SDK 3.24.3 storetells 1.0.0+1 dependencies: - camera 0.11.0+2 [camera_android_camerax camera_avfoundation camera_platform_interface camera_web flutter flutter_plugin_android_lifecycle] - cloud_firestore 5.4.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 5.1.2 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - cupertino_icons 1.0.8 - dart_geohash 2.1.0 - firebase_analytics 11.3.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 5.3.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 3.6.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 4.1.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_performance 0.10.0+7 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter] - firebase_remote_config 5.1.3 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_geo_hash 0.0.4 [flutter] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_map 7.0.2 [async collection dart_earcut flutter http latlong2 logger meta polylabel proj4dart vector_math] - flutter_map_cancellable_tile_provider 3.0.2 [dio flutter flutter_map meta] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - geolocator 13.0.1 [flutter geolocator_platform_interface geolocator_android geolocator_apple geolocator_web geolocator_windows] - go_router 14.2.7 [collection flutter flutter_web_plugins logging meta] - google_mlkit_barcode_scanning 0.12.1 [flutter google_mlkit_commons] - google_mlkit_commons 0.8.1 [flutter] - http 1.2.2 [async http_parser meta web] - intl 0.19.0 [clock meta path] - js 0.7.1 - latlong2 0.9.1 [intl] - material_symbols_icons 4.2785.1 [flutter] - provider 6.1.2 [collection flutter nested] - shared_preferences 2.3.2 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - slugify 2.0.0 - url_launcher 6.3.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - web 1.0.0 dev dependencies: - flutter_lints 4.0.0 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service] transitive dependencies: - _flutterfire_internals 1.3.44 [collection firebase_core firebase_core_platform_interface flutter meta] - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - camera_android_camerax 0.6.8+3 [async camera_platform_interface flutter meta stream_transform] - camera_avfoundation 0.9.17+3 [camera_platform_interface flutter stream_transform] - camera_platform_interface 2.8.0 [cross_file flutter plugin_platform_interface stream_transform] - camera_web 0.3.5 [camera_platform_interface flutter flutter_web_plugins stream_transform web] - characters 1.3.0 - clock 1.1.1 - cloud_firestore_platform_interface 6.4.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 4.3.1 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins] - cloud_functions_platform_interface 5.5.36 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.10.1 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - collection 1.18.0 - cross_file 0.3.4+2 [meta web] - crypto 3.0.5 [typed_data] - dart_earcut 1.1.0 - dio 5.7.0 [async http_parser meta path dio_web_adapter] - dio_web_adapter 2.0.0 [dio http_parser meta web] - fake_async 1.3.1 [clock collection] - ffi 2.1.3 - file 7.0.0 [meta path] - firebase_analytics_platform_interface 4.2.4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.10+1 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - firebase_auth_platform_interface 7.4.6 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.13.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web] - firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.18.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web] - firebase_crashlytics_platform_interface 3.6.43 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_performance_platform_interface 0.1.4+43 [_flutterfire_internals firebase_core flutter plugin_platform_interface] - firebase_performance_web 0.1.7+1 [_flutterfire_internals firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins] - firebase_remote_config_platform_interface 1.4.44 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.7.2 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins] - fixnum 1.1.0 - flutter_plugin_android_lifecycle 2.0.22 [flutter] - geolocator_android 4.6.1 [flutter geolocator_platform_interface meta uuid] - geolocator_apple 2.3.7 [flutter geolocator_platform_interface] - geolocator_platform_interface 4.2.4 [flutter plugin_platform_interface vector_math meta] - geolocator_web 4.1.1 [flutter flutter_web_plugins geolocator_platform_interface web] - geolocator_windows 0.2.3 [flutter geolocator_platform_interface] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - leak_tracker 10.0.5 [clock collection meta path vm_service] - leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 3.0.1 [leak_tracker matcher meta] - lints 4.0.0 - lists 1.0.1 [meta] - logger 2.4.0 - logging 1.2.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.11.1 [collection] - meta 1.15.0 - mgrs_dart 2.0.0 [unicode] - nested 1.0.0 [flutter] - path 1.9.0 - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.3.0 [ffi flutter path path_provider_platform_interface] - platform 3.1.5 - plugin_platform_interface 2.1.8 [meta] - polylabel 1.0.1 [collection] - proj4dart 2.1.0 [mgrs_dart wkt_parser meta] - shared_preferences_android 2.3.2 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.5.2 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.4.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.4.1 [flutter plugin_platform_interface] - shared_preferences_web 2.4.2 [flutter flutter_web_plugins shared_preferences_platform_interface web] - shared_preferences_windows 2.4.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.7.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - typed_data 1.3.2 [collection] - unicode 0.3.1 [lists] - url_launcher_android 6.3.10 [flutter url_launcher_platform_interface] - url_launcher_ios 6.3.1 [flutter url_launcher_platform_interface] - url_launcher_linux 3.2.0 [flutter url_launcher_platform_interface] - url_launcher_macos 3.2.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface] - url_launcher_web 2.3.3 [flutter flutter_web_plugins url_launcher_platform_interface web] - url_launcher_windows 3.1.2 [flutter url_launcher_platform_interface] - uuid 4.5.0 [crypto sprintf meta fixnum] - vector_math 2.1.4 - vm_service 14.2.5 - wkt_parser 2.0.0 - xdg_directories 1.0.4 [meta path] ```

Additional context and comments

No response

SelaseKay commented 1 month ago

Hi @pogorv12 , thanks for the report. However, I'm unable to reproduce this issue. It works fine on firebase_remote_config: 5.1.3. Kindly update your plugin versions and try again.

pogorv12 commented 1 month ago

Hello @SelaseKay ! Thanks for your quick response!

I've applied "flutter clean" and it solved the issue.
My fireabse_remote_config version is 5.1.3.