flutter_google_webservices 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Flutter Google Webservices #

flutter_google_webservices is a plugin useful to manage Google's APIs like Places (Details, Autocomplete...) and Maps. This plugin is in progress.

Soon new features.

Getting Started #

In your "pubspec.yaml" import the plugin.

// AUTOCOMPLETE EXAMPLE

var autocomplete = GetAutocomplete();

var result = autocomplete.getAutocompleteByString(STRING_TO_SEARCH, apiKey);

// DETAILS EXAMPLE

var details = GetDetails();

var result = details.getDetailsById(PLACE_ID_TO_SEARCH, apiKey);

[0.0.1] - 18/12/2019. #

First commit:

Get Google Places Autocomplete from String(address/country...) Get Google Places Autocomplete from PlaceId

Get Google Places Details from PlaceId

[0.0.2] - 18/12/2019. #

next some filters and more features.

[0.0.3] - 19/12/2019. #

Example of application added.

Implementation autocomolete stream(in testing).

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_google_webservices/flutter_google_webservices.dart';
import 'package:flutter_google_webservices/models/predictions.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Web Services Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Google Webservices Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String apyKey = "YOUR_API_KEY";
  String query ='';
  var autocomplete = GetAutocomplete(); 
  Predictions autoCompleteResult; // initialize autocomplete result

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
           Container(
             padding: EdgeInsets.all(8),
             margin: EdgeInsets.all(8),
             child: TextField(
               onChanged: (newString){
                 print(newString);
                 setState(() {
                   query = newString;
                 });
               },
               decoration: InputDecoration(
                 suffixIcon: IconButton(
                   icon: Icon(Icons.search),
                   onPressed: () async {
                     autoCompleteResult = await autocomplete.getAutocompleteByString(query, apyKey);
                     print(autoCompleteResult.status); //SHOW IF THE GET REQUEST IS OK
                     autoCompleteResult.predictions.forEach((result){
                       print(result.description); //print the name of the pleces found
                     });
                   },
                 )
               ),
             ),
           )
          ],
        ),
      ),
      
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_google_webservices: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_google_webservices/flutter_google_webservices.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_google_webservices that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.65 points)

251 out of 254 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/flutter_google_webservices.dart.

Run flutter format to format lib/flutter_google_webservices.dart.

Format lib/models/matched_substring.dart.

Run flutter format to format lib/models/matched_substring.dart.

Format lib/models/place.dart.

Run flutter format to format lib/models/place.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/models/plus_code.dart (Run flutter format to format lib/models/plus_code.dart.)
  • lib/models/predictions.dart (Run flutter format to format lib/models/predictions.dart.)
  • lib/models/reviews.dart (Run flutter format to format lib/models/reviews.dart.)
  • lib/models/structured_formatting.dart (Run flutter format to format lib/models/structured_formatting.dart.)
  • lib/models/term.dart (Run flutter format to format lib/models/term.dart.)
  • lib/models/viewport.dart (Run flutter format to format lib/models/viewport.dart.)
  • lib/services/detail_service.dart (Run flutter format to format lib/services/detail_service.dart.)
  • lib/services/prediciton_service.dart (Run flutter format to format lib/services/prediciton_service.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (rxdart).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

The package description is too short. (-1 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^3.0.7 3.0.9
flutter 0.0.0
json_annotation ^3.0.0 3.0.1
retrofit ^1.0.1+1 1.3.4
rxdart ^0.23.1 0.23.1 0.24.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
build_runner ^1.7.2
flutter_test
json_serializable ^3.2.3