当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
19 Star 122 Fork 136

OpenHarmony-SIG/flutter_packages
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

extension_google_sign_in_as_googleapis_auth

A bridge package between Flutter's google_sign_in plugin and Dart's googleapis package, that is able to create googleapis_auth-like AuthClient instances directly from the GoogleSignIn plugin.

Usage

This package is implemented as an extension method on top of the GoogleSignIn plugin.

In order to use it, you need to add a dependency to your pubspec.yaml. Then, wherever you're importing package:google_sign_in/google_sign_in.dart, add the following:

import 'package:extension_google_sign_in_as_googleapis_auth/extension_google_sign_in_as_googleapis_auth.dart';

From that moment on, your GoogleSignIn instance will have an additional Future<AuthClient?> authenticatedClient() method that you can call once your sign in is successful to retrieve an AuthClient.

That object can then be used to create instances of googleapis API clients:

final peopleApi = PeopleApi((await _googleSignIn.authenticatedClient())!);
final response = await peopleApi.people.connections.list(
  'people/me',
  personFields: 'names',
);

Example

This package contains a modified version of Flutter's Google Sign In example app that uses package:googleapis' API clients, instead of raw http requests.

See it here.

The original code (and its license) can be seen here.

Testing

Run tests with flutter test.

Issues and feedback

Please file issues to send feedback or report a bug. Thank you!

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony-sig/flutter_packages.git
git@gitee.com:openharmony-sig/flutter_packages.git
openharmony-sig
flutter_packages
flutter_packages
master

搜索帮助