Google Places Starter
A mason brick to populate a very good Flutter App ready to interact with the Google Places API.
๐ฆ This brick uses very_good_cli for the creation of the App. Therefore, this package features the same directory structure, and additional configurations found in a Flutter app and Dart package created with the following commands, respectively:
very_good create flutter_app
very_good create dart_pkg
๐จ This brick uses Super Initializers
. Make sure you're using dart 2.17 on your end.
โน๏ธ Info
This brick intends to facilitate and speed up the creation of a scalable Flutter App with built-in best practices ready to interact with the Google Places API out of the box.
-
๐ Allows developers to set different Google Maps API keys for their corresponding execution environments: development, staging, production.
-
๐ Includes the necessary configurations for Android and iOS to provide in-app location permission.
-
๐งช Comes with 100% code coverage through unit, bloc, and widget testing.
-
โจ And all from a single CLI command!
๐ป How to use
mason make google_places_starter
โ Outputs
Under the newly generated directory named after the provided app_name
, you will find:
.github
It contains all the GitHub workflows
for the main app as well as the included packages, among other files.
โโโ .github
| โโโ workflows
| | โโโ google_places_client.yaml
| | โโโ google_places_repo.yaml
| | โโโ main.yaml
| | โโโ permission_client.yaml
| โโโ dependabot.yaml
| โโโ PULL_REQUEST_TEMPLATE.md
โโโ ...
config
This directory contains the app_config.json
file which includes the Google Maps API keys for your App's different environments.
Notice this directory and all of its nested contents will not be checkout or committed to git since it's included in the .gitignore
file as it contains sensitive information.
โโโ config
| โโโ app_config.json
โโโ ...
lib
As in every Flutter App, this is the core directory where the app features will live.
This brick comes prepackaged with some features and an opinionated directory structure to help you get up and running with your App right away.
Most notably,
main
includes all the entry-point files to your app as well as the corresponding configuration files to handle app flavors.permission
includes a bloc that handles the location permission request for the underlying device-specific platform. This bloc will be accessible throughout the App as it is provided at the root of the Widget Tree.
โโโ lib
| โโโ app
| | โโโ view
| | | โโโ app.dart
| | โโโ app.dart
| โโโ home
| | โโโ view
| | | โโโ home_page.dart
| | โโโ home.dart
| โโโ l10n
| | โโโ arb
| | | โโโ app_en.arb
| | | โโโ app_es.arb
| | โโโ l10n.dart
| โโโ main
| | โโโ configs
| | | โโโ app_environment.dart
| | | โโโ config_reader.dart
| | | โโโ configs.dart
| | โโโ bootstrap.dart
| | โโโ main_common.dart
| | โโโ main_development.dart
| | โโโ main_production.dart
| | โโโ main_staging.dart
| โโโ permission
| | โโโ bloc
| | | โโโ permission_bloc.dart
| | | โโโ permission_event.dart
| | | โโโ permission_state.dart
| | โโโ permission.dart
โโโ ...
packages
This directory contains all the out-of-the-box packages that the newly created app relies on to function properly.
-
google_places_client
- Implements an http client to interact with the Google Places API. It currently supports:- Place Details - /details
- Find Place - /findplacefromtext
- Nearby Search - /nearbysearch
-
google_places_models
- Includes Dart models to handle JSON objects from the Google Places API.- This package is populated from the
google_places_models
template - check out the brick.
- This package is populated from the
-
google_places_repo
- Exposes a repository implementation to interact with the Google Places API via the GooglePlacesClient. -
permission_client
- Handles on-device permission requests.
โโโ packages
| โโโ google_places_client
| โโโ google_places_models
| โโโ google_places_repo
| โโโ permission_client
โโโ ...
๐ค Contribute
Would you like to enhance the functionality of this brick? Awesome!
Feel free to submit any PRs with your suggestions.