Skip to content
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

refactor: packages/alice #199

Merged
merged 24 commits into from
Jun 22, 2024
Merged

refactor: packages/alice #199

merged 24 commits into from
Jun 22, 2024

Conversation

techouse
Copy link
Collaborator

@techouse techouse commented Jun 16, 2024

This is a larger refactor, however, it's mostly cosmetic.

I've tested it and all looked OK, however, would be nice to throw another eye on it. :)

@@ -1,16 +1,10 @@
1include: package:very_good_analysis/analysis_options.yaml
analyzer:
Copy link
Owner

Choose a reason for hiding this comment

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

What is the reason of using flutter_lints instead of very_good_analysis?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One is standard and always up to date, the other one is custom and outdated (8 months +). It also pointed to some potential issues like using contexts across async gaps, using forEach where a for loop should be used, const optimizations, etc.

}
}

/// Get context from navigator key. Used to open inspector route.
BuildContext? getContext() => navigatorKey?.currentState?.overlay?.context;

String _getNotificationMessage() {
final calls = callsSubject.value;
final successCalls = calls
final List<AliceHttpCall> calls = callsSubject.value;
Copy link
Owner

Choose a reason for hiding this comment

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

I'm just thinking about this change - what's the reason of adding type of variable here? Is it for readability or is there any other reason?

Copy link
Owner

Choose a reason for hiding this comment

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

This question is also for other changes in this PR where you've added type for the variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Readability and conciseness. It's easier to understand what type of variable is this way without the help of an IDE when reviewing it on Github, for example.

}

final Directory? externalDir = switch (Platform.operatingSystem) {
"android" => await getExternalStorageDirectory(),
Copy link
Owner

Choose a reason for hiding this comment

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

I think android and ios could be moved to some consts definition in top of the class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@jhomlala
Copy link
Owner

Thank you for your effort, it looks good, but I have some questions. Check it please in your free time :)

@techouse
Copy link
Collaborator Author

Yes, please, take your time to review it. I've also added a feature to show the StackTrace in an expandable list tile in the error log.

@jhomlala
Copy link
Owner

LGTM! Thanks.

@jhomlala jhomlala merged commit 24d75ff into jhomlala:master Jun 22, 2024
2 checks passed
@techouse techouse deleted the refactor/packages/alice branch June 22, 2024 09:51
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.

2 participants