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

Feature: Latest launch #14

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Feature: Latest launch #14

wants to merge 26 commits into from

Conversation

ninogjoni
Copy link

Description

Just added the latest launch.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

test/helpers/pump_app.dart Outdated Show resolved Hide resolved
@ninogjoni
Copy link
Author

I implemented the suggestions.

@@ -93,4 +107,24 @@ class SpaceXApiClient {
throw JsonDecodeException();
}
}

Future<Map<String, dynamic>> _getOne(Uri uri) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Future<Map<String, dynamic>> _getOne(Uri uri) async {
Future<Map<String, dynamic>> _get(Uri uri) async {

Copy link
Author

Choose a reason for hiding this comment

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

_get is already defined for a "List" return. _getOne only returns an item.

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative might be _getMany for multiple results and _get for single ones, but I'm fine either way :)

@felangel Wdyt?
Unresolving for the time being for visibility 👀

Copy link
Contributor

@felangel felangel left a comment

Choose a reason for hiding this comment

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

See comments and lmk what you think -- overall looks great!

@ninogjoni
Copy link
Author

@felangel It's done

Copy link
Contributor

@jeroen-meijer jeroen-meijer left a comment

Choose a reason for hiding this comment

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

First off, thanks for these changes!

I just have a couple styling comments. Once those are implemented (or otherwise resolved), I'll have another look at the app in runtime.

I'll let the CI run in the meantime so you can work on potential failures. 👍🏻
Great job!

packages/launch_repository/lib/src/launch_repository.dart Outdated Show resolved Hide resolved
Comment on lines +17 to +18
launches:
(json['launches'] as List<dynamic>).map((e) => e as String).toList(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This will most likely fail the flutter format step 👀

packages/spacex_api/lib/src/models/launch.dart Outdated Show resolved Hide resolved
packages/spacex_api/lib/src/models/launch.dart Outdated Show resolved Hide resolved
packages/spacex_api/lib/src/models/launch.dart Outdated Show resolved Hide resolved
packages/spacex_api/lib/src/models/launch.dart Outdated Show resolved Hide resolved
@@ -93,4 +107,24 @@ class SpaceXApiClient {
throw JsonDecodeException();
}
}

Future<Map<String, dynamic>> _getOne(Uri uri) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative might be _getMany for multiple results and _get for single ones, but I'm fine either way :)

@felangel Wdyt?
Unresolving for the time being for visibility 👀

Copy link
Author

@ninogjoni ninogjoni left a comment

Choose a reason for hiding this comment

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

I'm not sure if that's right. The stringify getter in the Equatable package is set to null.
@alefl10 @jeroen-meijer

Copy link
Author

@ninogjoni ninogjoni left a comment

Choose a reason for hiding this comment

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

I've added some new tests, because code coverage is still too low. I looked the lcov results on my machine, and sometimes I don't understand why it did not cover certain code places. Furthermore, I also commented out failed tests in launches_page_test.dart so may have a look what I tried.

@ninogjoni
Copy link
Author

@jeroen-meijer @felangel Can someone please start the workflow? 😃

linter:
rules:
public_member_api_docs: false
avoid_print: false
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than disabling this for the whole package can we just ignore it from the example?

Copy link
Author

Choose a reason for hiding this comment

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

What do you mean exactly? I added this file like in the rocket_repository 😅

/// Throws a [LaunchException] if an error occurs.
Future<Launch> fetchLatestLaunch() {
try {
return _spaceXApiClient.fetchLatestLaunch();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return _spaceXApiClient.fetchLatestLaunch();
return await _spaceXApiClient.fetchLatestLaunch();

I believe we'd need to await the future in order to catch any exceptions.

Copy link
Author

Choose a reason for hiding this comment

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

It only awaits the future in the presentation layer, like in the "launches_cubit". If this is true for catching any exceptions, we also have to change it, e.g. in the rocket_repository too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants