0

I have trouble with flutter_google_places. The autocomplete doesn't work and returns E/SpannableStringBuilder(32620): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length in the console.

I have a registered api_key.

Here is the code

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_webservice/places.dart';
import 'package:flutter_google_places/flutter_google_places.dart';
import 'package:geocoder/geocoder.dart';

const kGoogleApiKey = "api_key";

GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: kGoogleApiKey);

class _CreateNewPostFormState extends State<CreateNewPostForm> {
  _getForm(BuildContext context, double screenWidth, double screenHeight) {
    switch (_dropDownValue) {
      case 1:
        {
          return Form(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  width: screenWidth * 0.9,
                  padding: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
                  margin: EdgeInsets.symmetric(vertical: 8),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    color: Colors.grey[200],
                  ),
                  child: TextFormField(
                    onTap: () async {
                      Prediction p = await PlacesAutocomplete.show(context: context, apiKey: kGoogleApiKey);
                    },
                    keyboardType: TextInputType.text,
                    decoration: InputDecoration(
                      border: InputBorder.none,
                      hintText:
                          AppLocalizations.of(context).translate('event_place'),

What should I do to have working code?

All help is welcomed thanks!

  • Could you please check this **[link](https://stackoverflow.com/questions/55870508/how-to-create-a-simple-google-maps-address-search-with-autocomplete-in-flutter-a/55877236)**? – rafon Jun 26 '20 at 05:28
  • Could you please try the solutions on this stackoverflow thread? it appears to have been answered at https://stackoverflow.com/questions/13670374/android-span-exclusive-exclusive-spans-cannot-have-a-zero-length – Mervin Samy Jun 29 '20 at 02:02
  • I have switch to geolocator. – Sir_Joan_the_third Jun 29 '20 at 10:29

0 Answers0