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

docs(flutter_todos): include barrel files in tutorial for completeness #4350

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/src/content/docs/tutorials/flutter-todos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ The `Todo` model uses [json_serializable](https://pub.dev/packages/json_serializ

The model of the `Todo` is defined in `todos_api/models/todo.dart` and is exported by `package:todos_api/todos_api.dart`.

#### Update Exports

Our ToDo model and the ToDosApi is made available externally (and internally) through barrel files. Notice how we don't import the ToDo model directly, but we import it in `lib/src/todos_api.dart` with a reference to the package barrel file: `import 'package:todos_api/todos_api.dart';`. Now, update the barrel files to resolve any remaining import errors.

<RemoteCode
url="https://raw.githubusercontent.com/felangel/bloc/master/examples/flutter_todos/packages/todos_api/lib/src/models/models.dart"
title="packages/todos_api/lib/src/models/models.dart"
/>

<RemoteCode
url="https://raw.githubusercontent.com/felangel/bloc/master/examples/flutter_todos/packages/todos_api/lib/todos_api.dart"
title="packages/todos_api/lib/todos_api.dart"
/>

#### Streams vs Futures

In a previous version of this tutorial, the `TodosApi` was `Future`-based rather than `Stream`-based.
Expand Down