@@ -18,7 +18,8 @@ sealed class AuthenticationFactor {
1818 AuthenticationFactorEmailOtp .fromProto (proto.emailOtp),
1919 pb.AuthenticationFactor_Factor .smsOtp =>
2020 AuthenticationFactorSmsOtp .fromProto (proto.smsOtp),
21- final unknown => throw ArgumentError .value (
21+ final unknown =>
22+ throw ArgumentError .value (
2223 unknown,
2324 'factor' ,
2425 'Invalid AuthenticationFactor. Expected one of: emailOtp, smsOtp' ,
@@ -27,13 +28,13 @@ sealed class AuthenticationFactor {
2728 }
2829
2930 pb.AuthenticationFactor toProto () => switch (this ) {
30- final AuthenticationFactorEmailOtp emailOtp => pb.AuthenticationFactor (
31- emailOtp: emailOtp.toValueProto (),
32- ),
33- final AuthenticationFactorSmsOtp smsOtp => pb.AuthenticationFactor (
34- smsOtp: smsOtp.toValueProto (),
35- ),
36- };
31+ final AuthenticationFactorEmailOtp emailOtp => pb.AuthenticationFactor (
32+ emailOtp: emailOtp.toValueProto (),
33+ ),
34+ final AuthenticationFactorSmsOtp smsOtp => pb.AuthenticationFactor (
35+ smsOtp: smsOtp.toValueProto (),
36+ ),
37+ };
3738
3839 GeneratedMessage toValueProto ();
3940
@@ -42,10 +43,7 @@ sealed class AuthenticationFactor {
4243}
4344
4445final class AuthenticationFactorEmailOtp extends AuthenticationFactor {
45- const AuthenticationFactorEmailOtp ({
46- required this .email,
47- this .code,
48- });
46+ const AuthenticationFactorEmailOtp ({required this .email, this .code});
4947
5048 factory AuthenticationFactorEmailOtp .fromProto (
5149 pb.AuthenticationFactorEmailOtp emailOtp,
@@ -66,17 +64,11 @@ final class AuthenticationFactorEmailOtp extends AuthenticationFactor {
6664
6765 @override
6866 pb.AuthenticationFactorEmailOtp toValueProto () =>
69- pb.AuthenticationFactorEmailOtp (
70- email: email,
71- code: code,
72- );
67+ pb.AuthenticationFactorEmailOtp (email: email, code: code);
7368}
7469
7570final class AuthenticationFactorSmsOtp extends AuthenticationFactor {
76- const AuthenticationFactorSmsOtp ({
77- required this .phoneNumber,
78- this .code,
79- });
71+ const AuthenticationFactorSmsOtp ({required this .phoneNumber, this .code});
8072
8173 factory AuthenticationFactorSmsOtp .fromProto (
8274 pb.AuthenticationFactorSmsOtp smsOtp,
@@ -96,10 +88,8 @@ final class AuthenticationFactorSmsOtp extends AuthenticationFactor {
9688 final String ? code;
9789
9890 @override
99- pb.AuthenticationFactorSmsOtp toValueProto () => pb.AuthenticationFactorSmsOtp (
100- phoneNumber: phoneNumber,
101- code: code,
102- );
91+ pb.AuthenticationFactorSmsOtp toValueProto () =>
92+ pb.AuthenticationFactorSmsOtp (phoneNumber: phoneNumber, code: code);
10393}
10494
10595final class SessionClient {
@@ -122,20 +112,17 @@ final class SessionClient {
122112 final SessionCallbacks callbacks;
123113
124114 pb.SessionClient toProto () => pb.SessionClient (
125- clientId: clientId,
126- clientType: clientType,
127- callbacks: callbacks.toProto (),
128- );
115+ clientId: clientId,
116+ clientType: clientType,
117+ callbacks: callbacks.toProto (),
118+ );
129119
130120 @override
131121 String toString () => toProto ().toString ();
132122}
133123
134124final class SessionCallbacks {
135- const SessionCallbacks ({
136- required this .successUri,
137- this .errorUri,
138- });
125+ const SessionCallbacks ({required this .successUri, this .errorUri});
139126
140127 factory SessionCallbacks .fromProto (pb.SessionCallbacks callbacks) {
141128 return SessionCallbacks (
@@ -149,9 +136,9 @@ final class SessionCallbacks {
149136 final Uri ? errorUri;
150137
151138 pb.SessionCallbacks toProto () => pb.SessionCallbacks (
152- successUri: successUri.toString (),
153- errorUri: errorUri? .toString (),
154- );
139+ successUri: successUri.toString (),
140+ errorUri: errorUri? .toString (),
141+ );
155142
156143 @override
157144 String toString () => toProto ().toString ();
@@ -196,22 +183,24 @@ final class SessionStateSuccess extends SessionState {
196183
197184 @override
198185 pb.AuthenticationSuccess toProto () => pb.AuthenticationSuccess (
199- identityToken: cork.toString (),
200- user: user.toProto (),
201- isNewUser: isNewUser,
202- );
186+ identityToken: cork.toString (),
187+ user: user.toProto (),
188+ isNewUser: isNewUser,
189+ );
203190}
204191
205192sealed class SessionStateNextStep extends SessionState {
206193 const SessionStateNextStep ();
207194
208195 factory SessionStateNextStep .fromProto (pb.AuthenticationStep proto) {
209196 return switch (proto.whichStep ()) {
210- pb.AuthenticationStep_Step .needsProof =>
211- SessionStateNeedsProof .fromProto (proto.needsProof),
197+ pb.AuthenticationStep_Step .needsProof => SessionStateNeedsProof .fromProto (
198+ proto.needsProof,
199+ ),
212200 pb.AuthenticationStep_Step .pendingConfirmation =>
213201 SessionStatePendingConfirmation .fromProto (proto.pendingConfirmation),
214- final unknown => throw ArgumentError .value (
202+ final unknown =>
203+ throw ArgumentError .value (
215204 unknown,
216205 'step' ,
217206 'Invalid AuthenticationStep. Expected one of: needsProof, pendingConfirmation' ,
@@ -221,14 +210,14 @@ sealed class SessionStateNextStep extends SessionState {
221210
222211 @override
223212 pb.AuthenticationStep toProto () => switch (this ) {
224- final SessionStateNeedsProof needsProof => pb.AuthenticationStep (
225- needsProof: needsProof.toValueProto (),
226- ),
227- final SessionStatePendingConfirmation pendingConfirmation =>
228- pb.AuthenticationStep (
229- pendingConfirmation: pendingConfirmation.toValueProto (),
230- ),
231- };
213+ final SessionStateNeedsProof needsProof => pb.AuthenticationStep (
214+ needsProof: needsProof.toValueProto (),
215+ ),
216+ final SessionStatePendingConfirmation pendingConfirmation =>
217+ pb.AuthenticationStep (
218+ pendingConfirmation: pendingConfirmation.toValueProto (),
219+ ),
220+ };
232221
233222 @override
234223 void apply (pb.Session session) {
@@ -237,9 +226,7 @@ sealed class SessionStateNextStep extends SessionState {
237226}
238227
239228final class SessionStateNeedsProof extends SessionStateNextStep {
240- const SessionStateNeedsProof ({
241- required this .factor,
242- });
229+ const SessionStateNeedsProof ({required this .factor});
243230 factory SessionStateNeedsProof .fromProto (pb.AuthenticationFactor proto) {
244231 return SessionStateNeedsProof (
245232 factor: AuthenticationFactor .fromProto (proto),
@@ -291,8 +278,8 @@ final class Session {
291278 this .clientInfo,
292279 this .ipAddress,
293280 this .externalSessionId,
294- }) : parent = parent ?? context.rootEntity,
295- sessionId = TypeId <Session >.decode (sessionId);
281+ }) : parent = parent ?? context.rootEntity,
282+ sessionId = TypeId <Session >.decode (sessionId);
296283
297284 const Session ._({
298285 required this .parent,
@@ -323,9 +310,7 @@ final class Session {
323310 final String ? ipAddress;
324311 final String ? externalSessionId;
325312
326- pb.Session toProto ({
327- String ? sessionToken,
328- }) {
313+ pb.Session toProto ({String ? sessionToken}) {
329314 final session = pb.Session (
330315 parent: parent? .id,
331316 sessionId: sessionId.encoded,
0 commit comments