Skip to content

Commit 07ef4af

Browse files
committed
convert social login to extension type
1 parent 52e4017 commit 07ef4af

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/src/web/static_interop/account.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@ extension type Accounts(JSObject _) {
5252
external Session get session;
5353

5454
/// Login using a social provider.
55-
external void Function(SocialLoginParameters parameters) socialLogin;
55+
///
56+
/// This function receives a [SocialLoginParameters] instance as argument,
57+
/// and has [JSVoid] as return type.
58+
external JSFunction socialLogin;
5659
}

lib/src/web/static_interop/parameters/login.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ extension type LoginParameters._(JSObject _) implements JSObject {
2424
});
2525
}
2626

27-
/// This class represents the parameters for the `Accounts.socialLogin` method.
27+
/// This extension type represents the parameters for the `Accounts.socialLogin` method.
2828
@JS()
2929
@anonymous
3030
@staticInterop
31-
class SocialLoginParameters {
31+
extension type SocialLoginParameters._(JSObject _) implements JSObject {
3232
/// Create a new [SocialLoginParameters] instance.
33+
///
34+
/// The [callback] receives a [LoginResponse] as argument,
35+
/// and has [JSVoid] as return type.
3336
external factory SocialLoginParameters({
3437
String? authFlow,
35-
void Function(LoginResponse response) callback,
38+
JSFunction callback,
3639
String? conflictHandling,
3740
String? extraFields,
3841
String? facebookExtraPermissions,

0 commit comments

Comments
 (0)