google_places_api_flutter 1.0.6 copy "google_places_api_flutter: ^1.0.6" to clipboard
google_places_api_flutter: ^1.0.6 copied to clipboard

Flutter package for integrating Google Places API into your Flutter apps, offering real-time autocomplete suggestions, place details, and more.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';

import 'package:google_places_api_flutter/google_places_api_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  final TextEditingController controller = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: PlaceSearchField(
            apiKey: "",
            isLatLongRequired: true,
            webCorsProxyUrl: "https://cors-anywhere.herokuapp.com",
            onPlaceSelected: (p0, p1) async {
              log(p0.toString());
              log(p1.toString());
            },
            decorationBuilder: (context, child) {
              return Material(
                type: MaterialType.card,
                elevation: 4,
                color: Colors.white,
                borderRadius: BorderRadius.circular(8),
                child: child,
              );
            },
            itemBuilder: (context, prediction) => ListTile(
              leading: const Icon(Icons.location_on),
              title: Text(
                prediction.description,
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
              ),
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
140
points
83
downloads

Publisher

verified publisheraslamportfolio.in

Weekly Downloads

Flutter package for integrating Google Places API into your Flutter apps, offering real-time autocomplete suggestions, place details, and more.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

build_runner, dartz, dio, flutter, flutter_bloc, flutter_typeahead, freezed, freezed_annotation, get_it, google_api_headers, injectable, logger, mockito

More

Packages that depend on google_places_api_flutter