refactor: Migrate to null safety

This commit is contained in:
Krille Fear 2022-01-29 12:35:03 +01:00 committed by Christian Pauly
commit 55f0300f9f
163 changed files with 1759 additions and 1903 deletions

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:matrix/matrix.dart';
extension ClientPresenceExtension on Client {

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:flutter/cupertino.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:matrix/matrix.dart';
import '../../config/app_config.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

View file

@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart';
import '../platform_infos.dart';
class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
FlutterMatrixHiveStore(String name, {HiveCipher encryptionCipher})
FlutterMatrixHiveStore(String name, {HiveCipher? encryptionCipher})
: super(
name,
encryptionCipher: encryptionCipher,
@ -28,7 +28,7 @@ class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
if (!kIsWeb && !_hiveInitialized) {
_hiveInitialized = true;
}
HiveCipher hiverCipher;
HiveCipher? hiverCipher;
try {
// Workaround for secure storage is calling Platform.operatingSystem on web
if (kIsWeb || Platform.isLinux) throw MissingPluginException();
@ -83,12 +83,12 @@ class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
return (await getApplicationDocumentsDirectory()).path;
}
} catch (_) {
return (await getDownloadsDirectory()).path;
return (await getDownloadsDirectory())!.path;
}
}
@override
Future<Uint8List> getFile(Uri mxcUri) async {
Future<Uint8List?> getFile(Uri mxcUri) async {
if (!supportsFileStoring) return null;
final tempDirectory = await _getFileStoreDirectory();
final file =

View file

@ -9,8 +9,7 @@ extension IosBadgeClientExtension on Client {
if (PlatformInfos.isIOS) {
// Workaround for iOS not clearing notifications with fcm_shared_isolate
if (!rooms.any((r) =>
r.membership == Membership.invite ||
(r.notificationCount != null && r.notificationCount > 0))) {
r.membership == Membership.invite || (r.notificationCount > 0))) {
// ignore: unawaited_futures
FlutterLocalNotificationsPlugin().cancelAll();
FlutterAppBadger.removeBadge();

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'dart:io';
import 'package:flutter/material.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';

View file

@ -1,5 +1,3 @@
//@dart=2.12
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';