Skip to content

kmrosiek/github-api-pagination

Repository files navigation

📱 GitHub Repository Viewer

Welcome to the GitHub Repository Viewer! This mobile application, built with Flutter, leverages the GitHub API to fetch repositories and issues for selected repositories. It serves as a comprehensive example of utilizing cubits with pagination to efficiently load and manage issues. This project highlights Flutter's capabilities and demonstrates best practices in state management and architectural patterns using 4-layers and monorepo approaches.

App Preview

📚 Table of Contents

🌟 Features and Packages

🛠 How to Run

This project employs a monorepo structure managed by Melos, which ensures a clean and modular codebase.

  1. Activate Melos:

    dart pub global activate melos
  2. Get dependencies:

    melos bootstrap
  3. Generate Files:

    melos generate
  4. Run the App:

    flutter run --dart-define=GITHUB_API_TOKEN=your_github_token

🗂 Project Structure

The project is organized as a monorepo, which is essential for maintaining a clear separation of concerns and a clean architecture as the project scales. By using multiple local packages, we establish clear boundaries between independent components of the codebase.

All packages are located inside the packages/ folder:

Project Structure

Key Packages:

  • common: Contains shared utilities and should not depend on any other local packages.
  • http_repository and go_router_navigator: rovide specific implementations and are injected using injectable and get_it. These packages should not be depended upon by other packages.

To visualize the project's dependencies, refer to the following dependency graph:

Dependency Graph

To ensure package dependency constraints are maintained, utilize this: packages-verifier.

🌐 Navigation

This application is designed to be independent of any navigation package. Although go_router is used for navigation, the codebase does not directly depend on it due to the navigator abstraction layer. This layer defines interfaces and route contracts fulfilled by the go_router_navigator package. Given that go_router is injected, thorough testing is necessary to prevent runtime errors.

go_router_navigator

Implements named routes with type-safe parameters, ensuring robust and maintainable navigation throughout the app.

🧪 Tests

Unit Tests

Unit tests for the blocs are conducted using the bloc_test package. To execute all tests, use Melos:

melos test

Integration Tests

Integration tests are set up with the patrol package, currently configured for iOS.
Patrol Test Preview

To run integration tests on a simulator:

  1. Activate Patrol CLI:

    dart pub global activate patrol_cli
  2. Run Tests:

    patrol test -t integration_test/app_test.dart

For more information, visit the Patrol documentation.

🐞 Known Bugs

  • The textfield occasionally becomes unresponsive when returning from the repository details screen.
  • Titles that span two lines in the repository search screen may overflow when transitioning back from the repository details screen due to different padding, leading to layout issues.

Thank you for exploring the GitHub Repository Viewer! I hope this project demonstrates the effective use of Flutter and its ecosystem. Happy coding! 🚀

About

Flutter Mobile application that leverages the GitHub API to fetch repositories and issues. It's a Monorepo (uses Melos), app from the navigator implementation (GoRouter), and demonstrated the use of Named Routes and Type Safe Routes combined.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages