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';
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ class BreakerProps extends DataHolder {
|
||||
for(var key in breakers.regional.keys) {
|
||||
GetBreakersReponseObject value = breakers.regional[key]!;
|
||||
|
||||
if(int.parse(key.split("b")[1]) >= selfVersion) {
|
||||
if(int.parse(key.split('b')[1]) >= selfVersion) {
|
||||
if(value.areas.contains(type)) return value.message;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import '../../api/marianumcloud/talk/chat/getChatResponse.dart';
|
||||
import '../dataHolder.dart';
|
||||
|
||||
class ChatProps extends DataHolder {
|
||||
String _queryToken = "";
|
||||
String _queryToken = '';
|
||||
DateTime _lastTokenSet = DateTime.now();
|
||||
|
||||
GetChatResponse? _getChatResponse;
|
||||
|
@ -21,7 +21,7 @@ class Endpoint {
|
||||
String domain;
|
||||
String path;
|
||||
|
||||
Endpoint({required this.domain, this.path = ""});
|
||||
Endpoint({required this.domain, this.path = ''});
|
||||
|
||||
String full() {
|
||||
return domain + path;
|
||||
@ -40,17 +40,17 @@ class EndpointData {
|
||||
EndpointMode getEndpointMode() {
|
||||
late String existingName;
|
||||
existingName = AccountData().getUsername();
|
||||
return existingName.startsWith("google") ? EndpointMode.stage : EndpointMode.live;
|
||||
return existingName.startsWith('google') ? EndpointMode.stage : EndpointMode.live;
|
||||
}
|
||||
|
||||
Endpoint webuntis() {
|
||||
return EndpointOptions(
|
||||
live: Endpoint(
|
||||
domain: "peleus.webuntis.com",
|
||||
domain: 'peleus.webuntis.com',
|
||||
),
|
||||
staged: Endpoint(
|
||||
domain: "mhsl.eu",
|
||||
path: "/marianum/marianummobile/webuntis/public/index.php/api"
|
||||
domain: 'mhsl.eu',
|
||||
path: '/marianum/marianummobile/webuntis/public/index.php/api'
|
||||
),
|
||||
).get(getEndpointMode());
|
||||
}
|
||||
@ -58,11 +58,11 @@ class EndpointData {
|
||||
Endpoint nextcloud() {
|
||||
return EndpointOptions(
|
||||
live: Endpoint(
|
||||
domain: "cloud.marianum-fulda.de",
|
||||
domain: 'cloud.marianum-fulda.de',
|
||||
),
|
||||
staged: Endpoint(
|
||||
domain: "mhsl.eu",
|
||||
path: "/marianum/marianummobile/cloud",
|
||||
domain: 'mhsl.eu',
|
||||
path: '/marianum/marianummobile/cloud',
|
||||
)
|
||||
).get(getEndpointMode());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ extension ExtendedList on List {
|
||||
|
||||
class FilesProps extends DataHolder {
|
||||
List<String> folderPath = List<String>.empty(growable: true);
|
||||
String currentFolderName = "Home";
|
||||
String currentFolderName = 'Home';
|
||||
|
||||
ListFilesResponse? _listFilesResponse;
|
||||
ListFilesResponse get listFilesResponse => _listFilesResponse!;
|
||||
@ -32,7 +32,7 @@ class FilesProps extends DataHolder {
|
||||
_listFilesResponse = null;
|
||||
notifyListeners();
|
||||
ListFilesCache(
|
||||
path: folderPath.isEmpty ? "/" : folderPath.join("/"),
|
||||
path: folderPath.isEmpty ? '/' : folderPath.join('/'),
|
||||
onUpdate: (ListFilesResponse data) => {
|
||||
_listFilesResponse = data,
|
||||
notifyListeners(),
|
||||
@ -48,7 +48,7 @@ class FilesProps extends DataHolder {
|
||||
|
||||
void popFolder() {
|
||||
folderPath.removeLast();
|
||||
if(folderPath.isEmpty) currentFolderName = "Home";
|
||||
if(folderPath.isEmpty) currentFolderName = 'Home';
|
||||
run();
|
||||
}
|
||||
}
|
@ -49,8 +49,8 @@ class TimetableProps extends DataHolder {
|
||||
@override
|
||||
void run({renew}) {
|
||||
GetTimetableCache(
|
||||
startdate: int.parse(DateFormat("yyyyMMdd").format(startDate)),
|
||||
enddate: int.parse(DateFormat("yyyyMMdd").format(endDate)),
|
||||
startdate: int.parse(DateFormat('yyyyMMdd').format(startDate)),
|
||||
enddate: int.parse(DateFormat('yyyyMMdd').format(endDate)),
|
||||
onUpdate: (GetTimetableResponse data) => {
|
||||
_getTimetableResponse = data,
|
||||
notifyListeners(),
|
||||
|
Reference in New Issue
Block a user