google_api_headers 1.0.0 copy "google_api_headers: ^1.0.0" to clipboard
google_api_headers: ^1.0.0 copied to clipboard

outdated

A Flutter plugin for getting the headers required for calling Google APIs with an app restricted key.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:google_api_headers/google_api_headers.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Map<String, String>? _headers;

  @override
  void initState() {
    super.initState();
    getHeaders();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text(
            'Google API headers: ${_headers.toString()}',
            textAlign: TextAlign.center,
          ),
        ),
      ),
    );
  }

  Future<void> getHeaders() async {
    final headers = await GoogleApiHeaders().getHeaders();
    setState(() => _headers = headers);
  }
}
22
likes
0
pub points
97%
popularity

Publisher

unverified uploader

A Flutter plugin for getting the headers required for calling Google APIs with an app restricted key.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, package_info

More

Packages that depend on google_api_headers