Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit e895915

Browse files
committed
Fix dart formatting
1 parent 49e1ea7 commit e895915

File tree

3 files changed

+45
-46
lines changed

3 files changed

+45
-46
lines changed

lib/app_config.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// Update these values
22
class AppConfig {
33
static const String backendUrl = 'https://4be6-71-211-245-221.ngrok-free.app';
4-
static const String powersyncUrl = 'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com';
4+
static const String powersyncUrl =
5+
'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com';
56
}

lib/widgets/login_page.dart

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,33 @@ class _LoginPageState extends State<LoginPage> {
2929
_busy = true;
3030
_error = null;
3131
});
32-
try {
33-
final credential = await FirebaseAuth.instance.signInWithEmailAndPassword(
34-
email: _usernameController.text,
35-
password: _passwordController.text
36-
);
37-
if(mounted) {
32+
try {
33+
await FirebaseAuth.instance.signInWithEmailAndPassword(
34+
email: _usernameController.text, password: _passwordController.text);
35+
if (context.mounted) {
3836
Navigator.of(context).pushReplacement(MaterialPageRoute(
3937
builder: (context) => listsPage,
4038
));
41-
}
42-
} on FirebaseAuthException catch (e) {
43-
if (e.code == 'user-not-found') {
44-
setState(() {
45-
_error = 'No user found for that email.';
46-
});
47-
} else if (e.code == 'wrong-password') {
39+
}
40+
} on FirebaseAuthException catch (e) {
41+
if (e.code == 'user-not-found') {
4842
setState(() {
49-
_error = 'Wrong password provided for that user.';
43+
_error = 'No user found for that email.';
5044
});
51-
}
52-
} catch (e) {
45+
} else if (e.code == 'wrong-password') {
46+
setState(() {
47+
_error = 'Wrong password provided for that user.';
48+
});
49+
}
50+
} catch (e) {
5351
setState(() {
5452
_error = e.toString();
5553
});
56-
} finally {
57-
setState(() {
58-
_busy = false;
59-
});
60-
}
54+
} finally {
55+
setState(() {
56+
_busy = false;
57+
});
58+
}
6159
}
6260

6361
@override

lib/widgets/signup_page.dart

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,35 @@ class _SignupPageState extends State<SignupPage> {
2929
_busy = true;
3030
_error = null;
3131
});
32-
try {
33-
final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword(
34-
email: _usernameController.text,
35-
password: _passwordController.text,
36-
);
37-
if(mounted) {
32+
try {
33+
await FirebaseAuth.instance.createUserWithEmailAndPassword(
34+
email: _usernameController.text,
35+
password: _passwordController.text,
36+
);
37+
if (context.mounted) {
3838
Navigator.of(context).pushReplacement(MaterialPageRoute(
39-
builder: (context) => homePage,
39+
builder: (context) => homePage,
4040
));
41-
}
42-
} on FirebaseAuthException catch (e) {
43-
if (e.code == 'weak-password') {
44-
setState(() {
45-
_error = 'The password provided is too weak.';
46-
});
47-
} else if (e.code == 'email-already-in-use') {
41+
}
42+
} on FirebaseAuthException catch (e) {
43+
if (e.code == 'weak-password') {
4844
setState(() {
49-
_error = 'The account already exists for that email.';
45+
_error = 'The password provided is too weak.';
5046
});
51-
}
52-
} catch (e) {
53-
setState(() {
54-
_error = e.toString();
55-
});
56-
} finally {
57-
setState(() {
47+
} else if (e.code == 'email-already-in-use') {
48+
setState(() {
49+
_error = 'The account already exists for that email.';
50+
});
51+
}
52+
} catch (e) {
53+
setState(() {
54+
_error = e.toString();
55+
});
56+
} finally {
57+
setState(() {
5858
_busy = false;
59-
});
60-
}
59+
});
60+
}
6161
}
6262

6363
@override

0 commit comments

Comments
 (0)