Merge pull request #480 from ente-io/migrate-to-null-safety
Migrate to null safety
This commit is contained in:
commit
0e517701a5
|
@ -1,5 +1,3 @@
|
|||
// @dart=2.9
|
||||
|
||||
class BackupStatus {
|
||||
final List<String> localIDs;
|
||||
final int size;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// @dart=2.9
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
class CollectionFileItem {
|
||||
|
@ -14,9 +12,9 @@ class CollectionFileItem {
|
|||
);
|
||||
|
||||
CollectionFileItem copyWith({
|
||||
int id,
|
||||
String encryptedKey,
|
||||
String keyDecryptionNonce,
|
||||
int? id,
|
||||
String? encryptedKey,
|
||||
String? keyDecryptionNonce,
|
||||
}) {
|
||||
return CollectionFileItem(
|
||||
id ?? this.id,
|
||||
|
@ -33,8 +31,10 @@ class CollectionFileItem {
|
|||
};
|
||||
}
|
||||
|
||||
factory CollectionFileItem.fromMap(Map<String, dynamic> map) {
|
||||
if (map == null) return null;
|
||||
factory CollectionFileItem.fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
throw ArgumentError('argument is null');
|
||||
}
|
||||
|
||||
return CollectionFileItem(
|
||||
map['id'],
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
// @dart=2.9
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class DeleteChallengeResponse {
|
||||
final bool allowDelete;
|
||||
final String encryptedChallenge;
|
||||
|
||||
DeleteChallengeResponse({
|
||||
@required this.allowDelete,
|
||||
this.encryptedChallenge,
|
||||
required this.allowDelete,
|
||||
required this.encryptedChallenge,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// @dart=2.9
|
||||
|
||||
import 'dart:typed_data';
|
||||
|
||||
class DerivedKeyResult {
|
||||
final Uint8List key;
|
||||
final Uint8List salt;
|
||||
final int memLimit;
|
||||
final int opsLimit;
|
||||
|
||||
DerivedKeyResult(this.key, this.salt);
|
||||
DerivedKeyResult(this.key, this.memLimit, this.opsLimit);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// @dart=2.9
|
||||
|
||||
import 'dart:typed_data';
|
||||
|
||||
class EncryptionResult {
|
||||
|
@ -8,5 +6,10 @@ class EncryptionResult {
|
|||
final Uint8List header;
|
||||
final Uint8List nonce;
|
||||
|
||||
EncryptionResult({this.encryptedData, this.key, this.header, this.nonce});
|
||||
EncryptionResult({
|
||||
required this.encryptedData,
|
||||
required this.key,
|
||||
required this.header,
|
||||
required this.nonce,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
// EnteFile is base file entry for various type of files
|
||||
// like DeviceFile,RemoteFile or TrashedFile
|
||||
|
||||
// @dart=2.9
|
||||
|
||||
abstract class EnteFile {
|
||||
// returns cacheKey which should be used while caching entry related to
|
||||
// this file.
|
||||
String cacheKey();
|
||||
|
||||
// returns localIdentifier for the file on the host OS.
|
||||
// Can be null if the file only exist on remote
|
||||
String localIdentifier();
|
||||
}
|
||||
|
|
|
@ -277,11 +277,6 @@ class File extends EnteFile {
|
|||
@override
|
||||
String cacheKey() {
|
||||
// todo: Neeraj: 19thJuly'22: evaluate and add fileHash as the key?
|
||||
return localID ?? uploadedFileID?.toString() ?? generatedID?.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
String localIdentifier() {
|
||||
return localID;
|
||||
return localID ?? uploadedFileID?.toString() ?? generatedID.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'dart:typed_data';
|
|||
import 'package:computer/computer.dart';
|
||||
import 'package:flutter_sodium/flutter_sodium.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:photos/models/derived_key_result.dart';
|
||||
import 'package:photos/models/encryption_result.dart';
|
||||
|
||||
const int encryptionChunkSize = 4 * 1024 * 1024;
|
||||
|
@ -330,11 +331,3 @@ class CryptoUtil {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedKeyResult {
|
||||
final Uint8List key;
|
||||
final int memLimit;
|
||||
final int opsLimit;
|
||||
|
||||
DerivedKeyResult(this.key, this.memLimit, this.opsLimit);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue