refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -45,11 +45,8 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.deletePusher(
|
||||
PusherId(
|
||||
appId: pusher.appId,
|
||||
pushkey: pusher.pushkey,
|
||||
),
|
||||
),
|
||||
PusherId(appId: pusher.appId, pushkey: pusher.pushkey),
|
||||
),
|
||||
);
|
||||
|
||||
if (success.error != null) return;
|
||||
|
|
@ -66,10 +63,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
isLoading = true;
|
||||
});
|
||||
try {
|
||||
final updateFromSync = Matrix.of(context)
|
||||
.client
|
||||
.onSync
|
||||
.stream
|
||||
final updateFromSync = Matrix.of(context).client.onSync.stream
|
||||
.where(
|
||||
(syncUpdate) =>
|
||||
syncUpdate.accountData?.any(
|
||||
|
|
@ -78,17 +72,16 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
false,
|
||||
)
|
||||
.first;
|
||||
await Matrix.of(context).client.setPushRuleEnabled(
|
||||
kind,
|
||||
pushRule.ruleId,
|
||||
!pushRule.enabled,
|
||||
);
|
||||
await Matrix.of(
|
||||
context,
|
||||
).client.setPushRuleEnabled(kind, pushRule.ruleId, !pushRule.enabled);
|
||||
await updateFromSync;
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to toggle push rule', e, s);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text(e.toLocalizedString(context))));
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(e.toLocalizedString(context))));
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
|
@ -116,9 +109,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
scrollDirection: Axis.horizontal,
|
||||
child: SelectableText(
|
||||
prettyJson(rule.toJson()),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
style: TextStyle(color: theme.colorScheme.onSurface),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -158,10 +149,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
isLoading = true;
|
||||
});
|
||||
try {
|
||||
final updateFromSync = Matrix.of(context)
|
||||
.client
|
||||
.onSync
|
||||
.stream
|
||||
final updateFromSync = Matrix.of(context).client.onSync.stream
|
||||
.where(
|
||||
(syncUpdate) =>
|
||||
syncUpdate.accountData?.any(
|
||||
|
|
@ -170,17 +158,14 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
|||
false,
|
||||
)
|
||||
.first;
|
||||
await Matrix.of(context).client.deletePushRule(
|
||||
kind,
|
||||
rule.ruleId,
|
||||
);
|
||||
await Matrix.of(context).client.deletePushRule(kind, rule.ruleId);
|
||||
await updateFromSync;
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to delete push rule', e, s);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(e.toLocalizedString(context))),
|
||||
);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(e.toLocalizedString(context))));
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue