A Flutter application using clean architecture and Bloc for state management to integrate Mapbox functionalities such as fetching polylines, tracking user location, and searching locations.
Features
- Fetch and display polylines from a remote data source.
- Track the user's current location.
- Search for specific locations using a query.
- Uses Clean Architecture principles for better scalability and maintainability.
- Implements Bloc for predictable and testable state management.
- Modular project structure for Domain, Data, and Presentation layers.
lib/
├── core/
│ ├── error/
│ │ ├── exceptions.dart
│ │ ├── failures.dart
│ ├── usecases/
│ │ ├── usecase.dart
│ ├── constants/
│ ├── constants.dart
├── features/
│ ├── map/
│ │ ├── data/
│ │ │ ├── datasources/
│ │ │ │ ├── map_remote_data_source.dart
│ │ │ ├── repositories/
│ │ │ ├── map_repository_impl.dart
│ │ ├── domain/
│ │ │ ├── entities/
│ │ │ │ ├── location.dart
│ │ │ ├── repositories/
│ │ │ │ ├── map_repository.dart
│ │ │ ├── usecases/
│ │ │ ├── get_polylines.dart
│ │ │ ├── get_user_location.dart
│ │ │ ├── search_location.dart
│ │ ├── presentation/
│ │ ├── bloc/
│ │ │ ├── map_bloc.dart
│ │ │ ├── map_event.dart
│ │ │ ├── map_state.dart
│ │ ├── pages/
│ │ ├── map_page.dart
- Flutter SDK (≥ 3.0.0)
- Dart SDK
- Mapbox Access Token (Sign up and generate one)
- Clone the repository:
git clone https://github.com/your-username/flutter-mapbox](https://github.com/Qasim-afzaal/flutter_3d_map_box.git cd flutter-mapbox
- Install dependencies:
flutter pub get
- Add your Mapbox access token in
lib/core/constants/constants.dart
:static const String mapboxAccessToken = 'your_mapbox_access_token'; static const String mapboxStyleUrl = 'your_mapbox_style_url';
- Run the app:
flutter run
Tap the map icon to fetch polylines and display them in the UI.
User location will automatically be fetched when the respective button (or functionality) is triggered.
Enter a query in the search field to fetch details about a specific location.
- flutter_bloc – Bloc for state management.
- equatable – Simplifies value comparison.
- dartz – Functional programming support.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature"
- Push to the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any queries or feedback, feel free to reach out:
- Author: Muhammad Qasim
- Email: [email protected]
- GitHub: https://github.com/Qasim-afzaal