google_api_headers 0.2.0-nullsafety.1 copy "google_api_headers: ^0.2.0-nullsafety.1" to clipboard
google_api_headers: ^0.2.0-nullsafety.1 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);
  }
}
27
likes
0
pub points
98%
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