updated project linter-rules and enforced them
This commit is contained in:
@ -10,8 +10,8 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'accountModel.dart';
|
||||
|
||||
class AccountData {
|
||||
static const _usernameField = "username";
|
||||
static const _passwordField = "password";
|
||||
static const _usernameField = 'username';
|
||||
static const _passwordField = 'password';
|
||||
|
||||
static final AccountData _instance = AccountData._construct();
|
||||
final Future<SharedPreferences> _storage = SharedPreferences.getInstance();
|
||||
@ -29,21 +29,21 @@ class AccountData {
|
||||
String? _password;
|
||||
|
||||
String getUsername() {
|
||||
if(_username == null) throw Exception("Username not initialized");
|
||||
if(_username == null) throw Exception('Username not initialized');
|
||||
return _username!;
|
||||
}
|
||||
|
||||
String getPassword() {
|
||||
if(_password == null) throw Exception("Password not initialized");
|
||||
if(_password == null) throw Exception('Password not initialized');
|
||||
return _password!;
|
||||
}
|
||||
|
||||
String getUserSecret() {
|
||||
return sha512.convert(utf8.encode("${AccountData().getUsername()}:${AccountData().getPassword()}")).toString();
|
||||
return sha512.convert(utf8.encode('${AccountData().getUsername()}:${AccountData().getPassword()}')).toString();
|
||||
}
|
||||
|
||||
Future<String> getDeviceId() async {
|
||||
return sha512.convert(utf8.encode("${getUserSecret()}@${await FirebaseMessaging.instance.getToken()}")).toString();
|
||||
return sha512.convert(utf8.encode('${getUserSecret()}@${await FirebaseMessaging.instance.getToken()}')).toString();
|
||||
}
|
||||
|
||||
Future<void> setData(String username, String password) async {
|
||||
@ -84,7 +84,7 @@ class AccountData {
|
||||
}
|
||||
|
||||
String buildHttpAuthString() {
|
||||
if(!isPopulated()) throw Exception("AccountData (e.g. username or password) is not initialized!");
|
||||
return "$_username:$_password";
|
||||
if(!isPopulated()) throw Exception('AccountData (e.g. username or password) is not initialized!');
|
||||
return '$_username:$_password';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user