dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
@@ -9,7 +9,8 @@ import 'authenticate_response.dart';
class Authenticate extends WebuntisApi {
AuthenticateParams param;
Authenticate(this.param) : super('authenticate', param, authenticatedResponse: false);
Authenticate(this.param)
: super('authenticate', param, authenticatedResponse: false);
@override
Future<AuthenticateResponse> run() async {
@@ -17,7 +18,11 @@ class Authenticate extends WebuntisApi {
try {
final rawAnswer = await query(this);
final decoded = jsonDecode(rawAnswer) as Map<String, dynamic>;
final response = finalize(AuthenticateResponse.fromJson(decoded['result'] as Map<String, dynamic>));
final response = finalize(
AuthenticateResponse.fromJson(
decoded['result'] as Map<String, dynamic>,
),
);
_lastResponse = response;
if (!awaitedResponse.isCompleted) awaitedResponse.complete();
return response;
@@ -40,23 +45,22 @@ class Authenticate extends WebuntisApi {
static Future<void> createSession() async {
_lastResponse = await Authenticate(
AuthenticateParams(
user: AccountData().getUsername(),
password: AccountData().getPassword(),
)
AuthenticateParams(
user: AccountData().getUsername(),
password: AccountData().getPassword(),
),
).run();
}
static Future<AuthenticateResponse> getSession() async {
if(awaitingResponse) {
if (awaitingResponse) {
await awaitedResponse.future;
}
if(_lastResponse == null) {
if (_lastResponse == null) {
awaitingResponse = true;
await createSession();
}
return _lastResponse!;
}
}