refactor: Enable more strict lints
This commit is contained in:
parent
f797bce8d0
commit
28af7bb0c7
65 changed files with 170 additions and 146 deletions
|
|
@ -72,7 +72,7 @@ class BackgroundPush {
|
|||
|
||||
bool upAction = false;
|
||||
|
||||
void _init() async {
|
||||
Future<void> _init() async {
|
||||
//<GOOGLE_SERVICES>firebaseEnabled = true;
|
||||
try {
|
||||
mainIsolateReceivePort?.listen((message) async {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ extension ClientDownloadContentExtension on Client {
|
|||
width: width,
|
||||
height: height,
|
||||
animated: animated,
|
||||
method: thumbnailMethod!,
|
||||
method: thumbnailMethod,
|
||||
)
|
||||
: mxc;
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ abstract class ClientManager {
|
|||
);
|
||||
}
|
||||
|
||||
static void sendInitNotification(String title, String body) async {
|
||||
static Future<void> sendInitNotification(String title, String body) async {
|
||||
if (kIsWeb) {
|
||||
html.Notification(title, body: body);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ class ErrorReporter {
|
|||
'HandshakeException',
|
||||
};
|
||||
|
||||
void onErrorCallback(Object error, [StackTrace? stackTrace]) {
|
||||
Future<void> onErrorCallback(Object error, [StackTrace? stackTrace]) async {
|
||||
if (ingoredTypes.contains(error.runtimeType.toString())) return;
|
||||
Logs().e(message ?? 'Error caught', error, stackTrace);
|
||||
final text = '$error\n${stackTrace ?? ''}';
|
||||
return _onErrorCallback(text);
|
||||
}
|
||||
|
||||
void _onErrorCallback(String text) async {
|
||||
Future<void> _onErrorCallback(String text) async {
|
||||
await showAdaptiveDialog(
|
||||
context: context!,
|
||||
builder: (context) => AlertDialog.adaptive(
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class MarkdownContextBuilder extends StatelessWidget {
|
|||
controller.text = controller.text.replaceRange(
|
||||
selection.start,
|
||||
selection.end,
|
||||
'[$selectedText](${url.toString()})',
|
||||
'[$selectedText]($url)',
|
||||
);
|
||||
ContextMenuController.removeAny();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ extension LocalizedBody on Event {
|
|||
},
|
||||
);
|
||||
|
||||
void saveFile(BuildContext context) async {
|
||||
Future<void> saveFile(BuildContext context) async {
|
||||
final matrixFile = await _getFile(context);
|
||||
|
||||
matrixFile.result?.save(context);
|
||||
}
|
||||
|
||||
void shareFile(BuildContext context) async {
|
||||
Future<void> shareFile(BuildContext context) async {
|
||||
final matrixFile = await _getFile(context);
|
||||
inspect(matrixFile);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Future<String?> getDatabaseCipher() async {
|
|||
return password;
|
||||
}
|
||||
|
||||
void _sendNoEncryptionWarning(Object exception) async {
|
||||
Future<void> _sendNoEncryptionWarning(Object exception) async {
|
||||
final isStored = AppSettings.noEncryptionWarningShown.value;
|
||||
|
||||
if (isStored == true) return;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:fluffychat/utils/size_string.dart';
|
||||
|
||||
extension MatrixFileExtension on MatrixFile {
|
||||
void save(BuildContext context) async {
|
||||
Future<void> save(BuildContext context) async {
|
||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||
final l10n = L10n.of(context);
|
||||
final downloadPath = await FilePicker.platform.saveFile(
|
||||
|
|
@ -31,7 +31,7 @@ extension MatrixFileExtension on MatrixFile {
|
|||
return FileType.any;
|
||||
}
|
||||
|
||||
void share(BuildContext context) async {
|
||||
Future<void> share(BuildContext context) async {
|
||||
// Workaround for iPad from
|
||||
// https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus/share_plus#ipad
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ Future<void> waitForPushIsolateDone() async {
|
|||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void notificationTapBackground(
|
||||
Future<void> notificationTapBackground(
|
||||
NotificationResponse notificationResponse,
|
||||
) async {
|
||||
final sendPort = IsolateNameServer.lookupPortByName(
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ abstract class PlatformInfos {
|
|||
return version;
|
||||
}
|
||||
|
||||
static void showDialog(BuildContext context) async {
|
||||
static Future<void> showDialog(BuildContext context) async {
|
||||
final version = await PlatformInfos.getVersion();
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
|||
abstract class UpdateNotifier {
|
||||
static const String versionStoreKey = 'last_known_version';
|
||||
|
||||
static void showUpdateSnackBar(BuildContext context) async {
|
||||
static Future<void> showUpdateSnackBar(BuildContext context) async {
|
||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||
final currentVersion = await PlatformInfos.getVersion();
|
||||
final store = await SharedPreferences.getInstance();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import 'package:fluffychat/utils/sign_in_flows/sso_login.dart';
|
|||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
void connectToHomeserverFlow(
|
||||
Future<void> connectToHomeserverFlow(
|
||||
PublicHomeserverData homeserverData,
|
||||
BuildContext context,
|
||||
void Function(AsyncSnapshot<bool>) setState,
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ extension SizeString on num {
|
|||
if (size < 1000 * 1000) {
|
||||
size = size / 1000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} KB';
|
||||
return '$size KB';
|
||||
}
|
||||
if (size < 1000 * 1000 * 1000) {
|
||||
size = size / 1000000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} MB';
|
||||
return '$size MB';
|
||||
}
|
||||
size = size / 1000 * 1000 * 1000 * 1000;
|
||||
size = (size * 10).round() / 10;
|
||||
return '${size.toString()} GB';
|
||||
return '$size GB';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class UrlLauncher {
|
|||
|
||||
const UrlLauncher(this.context, this.url, [this.name]);
|
||||
|
||||
void launchUrl() async {
|
||||
Future<void> launchUrl() async {
|
||||
if (url!.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
|
||||
url!.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
|
||||
{'#', '@', '!', '+', '\$'}.contains(url![0]) ||
|
||||
|
|
@ -117,7 +117,7 @@ class UrlLauncher {
|
|||
);
|
||||
}
|
||||
|
||||
void openMatrixToUrl() async {
|
||||
Future<void> openMatrixToUrl() async {
|
||||
final matrix = Matrix.of(context);
|
||||
final url = this.url!.replaceFirst(
|
||||
AppConfig.deepLinkPrefix,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue