Skip to content

fix: handle null configurations key in reconfigure dart config#434

Open
Harshit-0413 wants to merge 1 commit intoinvertase:mainfrom
Harshit-0413:main
Open

fix: handle null configurations key in reconfigure dart config#434
Harshit-0413 wants to merge 1 commit intoinvertase:mainfrom
Harshit-0413:main

Conversation

@Harshit-0413
Copy link
Copy Markdown

Fixes #353

Problem

When running flutterfire configure twice and choosing to reuse the
existing firebase.json, the command crashes with:

Exception: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast

This happens in _writeDartConfigurationFile in reconfigure.dart
where map[kConfigurations] is cast directly without a null check.
If the existing firebase.json was written by an older CLI version
that didn't include the configurations key, the cast throws.

Fix

Cast map[kConfigurations] as nullable Map<String, dynamic>? and
return early if null, skipping that entry gracefully.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the reconfigure.dart file to handle cases where the configurations map might be null. It introduces a null-safe cast and a check that returns an empty list if the configurations are missing, preventing potential runtime errors. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: flutterfire configure fails on reusing firebase.json

2 participants