Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## NEXT
## 2.4.0

* Introduces: `canAccessScopes` method and `userDataEvents` stream.
* These enable separation of Authentication and Authorization, and asynchronous
sign-in operations where needed (on the web, for example!)
* Updates minimum Flutter version to 3.3.
* Aligns Dart and Flutter SDK constraints.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ abstract class GoogleSignInPlatform extends PlatformInterface {
/// Scopes should come from the full list
/// [here](https://developers.google.com/identity/protocols/googlescopes).
Future<bool> requestScopes(List<String> scopes) async {
throw UnimplementedError('requestScopes() has not been implmented.');
throw UnimplementedError('requestScopes() has not been implemented.');
}

/// Determines if the current user can access all [scopes].
///
/// Optionally, an [accessToken] can be passed for applications where a
/// long-lived token may be cached (like the web).
Future<bool> canAccessScopes(
List<String> scopes, {
String? accessToken,
}) async {
throw UnimplementedError('canAccessScopes() has not been implemented.');
}

/// Returns a stream of [GoogleSignInUserData] authentication events.
///
/// These will normally come from asynchronous flows, like the Google Sign-In
/// Button Widget from the Web implementation, and will be funneled directly
/// to the `onCurrentUserChanged` Stream of the plugin.
Stream<GoogleSignInUserData?>? get userDataEvents => null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_sign_i
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.3.1
version: 2.4.0

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ void main() {
expect(log, tests.values);
});

test('canAccessScopes is unimplemented', () async {
expect(() async {
await googleSignIn
.canAccessScopes(<String>['someScope'], accessToken: 'token');
}, throwsUnimplementedError);
});

test('userDataEvents returns null', () async {
expect(googleSignIn.userDataEvents, isNull);
});

test('initWithParams passes through arguments to the channel', () async {
await googleSignIn.initWithParams(const SignInInitParameters(
hostedDomain: 'example.com',
Expand Down