chore: Avoid unnecessary lambdas
This commit is contained in:
parent
5283d0fcc8
commit
a0a03941c2
13 changed files with 19 additions and 32 deletions
|
|
@ -4,10 +4,10 @@ import 'package:matrix/matrix.dart';
|
|||
|
||||
IconData _getIconFromName(String displayname) {
|
||||
final name = displayname.toLowerCase();
|
||||
if ({'android'}.any((s) => name.contains(s))) {
|
||||
if ({'android'}.any(name.contains)) {
|
||||
return Icons.phone_android_outlined;
|
||||
}
|
||||
if ({'ios', 'ipad', 'iphone', 'ipod'}.any((s) => name.contains(s))) {
|
||||
if ({'ios', 'ipad', 'iphone', 'ipod'}.any(name.contains)) {
|
||||
return Icons.phone_iphone_outlined;
|
||||
}
|
||||
if ({
|
||||
|
|
@ -19,16 +19,10 @@ IconData _getIconFromName(String displayname) {
|
|||
'/_matrix',
|
||||
'safari',
|
||||
'opera',
|
||||
}.any((s) => name.contains(s))) {
|
||||
}.any(name.contains)) {
|
||||
return Icons.web_outlined;
|
||||
}
|
||||
if ({
|
||||
'desktop',
|
||||
'windows',
|
||||
'macos',
|
||||
'linux',
|
||||
'ubuntu',
|
||||
}.any((s) => name.contains(s))) {
|
||||
if ({'desktop', 'windows', 'macos', 'linux', 'ubuntu'}.any(name.contains)) {
|
||||
return Icons.desktop_mac_outlined;
|
||||
}
|
||||
return Icons.device_unknown_outlined;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ extension StreamExtension on Stream {
|
|||
};
|
||||
final subscription = listen(
|
||||
(_) => onMessage?.call(),
|
||||
onDone: () => controller.close(),
|
||||
onDone: controller.close,
|
||||
onError: (e, s) => controller.addError(e, s),
|
||||
);
|
||||
// add proper cleanup to the subscription and the controller, to not memory leak
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@ extension UiaRequestManager on MatrixState {
|
|||
|
||||
launchUrl(url, mode: LaunchMode.inAppBrowserView);
|
||||
final completer = Completer();
|
||||
final listener = AppLifecycleListener(
|
||||
onResume: () => completer.complete(),
|
||||
);
|
||||
final listener = AppLifecycleListener(onResume: completer.complete);
|
||||
await completer.future;
|
||||
listener.dispose();
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class UrlLauncher {
|
|||
.split(';')
|
||||
.first
|
||||
.split(',')
|
||||
.map((s) => double.tryParse(s))
|
||||
.map(double.tryParse)
|
||||
.toList();
|
||||
if (latlong.length == 2 &&
|
||||
latlong.first != null &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue