-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of configurable environment[stg, prod] #58
Conversation
pritam-bs
commented
Oct 30, 2023
•
edited
Loading
edited
- Flutter SDK version up
- update dependencies
- make stg, prod env configurable
- refactor nstack builder
- update dependencies - make stg, prod env configurable
lib/src/nstack_builder.dart
Outdated
const _config = NStackConfig(projectId: '$projectId', apiKey: '$apiKey',); | ||
const _config = NStackConfig(projectId: '$projectId', apiKey: '$apiKey', env: '$env'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to discuss this more, with this implementation you would need to rebuild the code if you want to switch environments, but what if someone wants to switch programmatically or using an env variable like dart-defines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stg environment is only intended for NStack developers not for the end users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pritam-bs can we document this in the code then? I know it's mentioned in the NStack docs, we can leave a link to it for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to generate doc using the template system in future PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This template generator seems cool, great that you found it 👍
- DartFormatter - Other changes
lib/src/nstack_template.txt
Outdated
if (!_initializedNStack) { | ||
_nstack | ||
.appOpen(Localizations.localeOf(context), | ||
platformOverride: widget.platformOverride) | ||
.whenComplete(() => widget.onComplete?.call()); | ||
_initializedNStack = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pritam-bs yeah this is because in Localizations.localeOf
we're trying to depend on an inherited widget before the widget is add such subscriptions. We should add WidgetBinding.instance.addPostFrameCallback
or get the localization in didChangeDependencies
(be careful though as didChangeDependencies
is executed quite often when a top level inherited widget changes (more here). Let's do either of these options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pritam-bs I like how more compact and readable the code is now👍
Could you please install this linter package monstarlab_lints
to ensure we maintain the needed code style?
- flutter sdk version up - build_runner version up - handle empty language response - other changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@hassan-saleh-ml please have a look as well