]> git.proxmox.com Git - flutter/proxmox_dart_api_client.git/commitdiff
cleanup: do use curly brackets
authorTim Marx <t.marx@proxmox.com>
Thu, 2 Jul 2020 10:03:53 +0000 (12:03 +0200)
committerTim Marx <t.marx@proxmox.com>
Thu, 2 Jul 2020 10:03:53 +0000 (12:03 +0200)
Signed-off-by: Tim Marx <t.marx@proxmox.com>
lib/src/credentials.dart
lib/src/models/pve_nodes_lxc_config_model.dart
lib/src/models/pve_nodes_qemu_config_model.dart

index 719fa7a381453b4bd79ae11da3012363438d33e7..65fab1662257bdcff187340cb091c5bc64eca0c1 100644 (file)
@@ -31,27 +31,31 @@ class Credentials {
   // Factory constructors can't be async....
   static Future<Credentials> fromPlatformStorage([String name = 'PVE']) async {
     final origin = await getPlatformAwareOrigin();
-    if (origin == null || origin.isEmpty)
+    if (origin == null || origin.isEmpty) {
       throw ArgumentError('Could not determine origin');
+    }
 
     final ticketEndpoint = Uri.parse('$origin/api2/json/access/ticket');
 
     final ticket = await getTicketFromStorage();
-    if (ticket == null || ticket.isEmpty)
+    if (ticket == null || ticket.isEmpty) {
       throw ArgumentError('Ticket not found');
+    }
 
     final matches = RegExp(r'(?:PVE|PMG|PMGQUAR):(?:(\S+):)?([A-Z0-9]{8})')
         .firstMatch(ticket);
     if (matches == null) throw FormatException('invalid cookie format');
 
     final username = matches.group(1);
-    if (username == null)
+    if (username == null) {
       throw FormatException('No username - invalid cookie format');
+    }
 
     final time = DateTime.fromMillisecondsSinceEpoch(
         int.parse(matches.group(2), radix: 16) * 1000);
-    if (time == null)
+    if (time == null) {
       throw FormatException('No expiration time - invalid cookie format');
+    }
 
     return Credentials(ticketEndpoint, username,
         ticket: ticket, expiration: time);
index ffe7ac8d1273c00d7cf7e783373d90f78a2e08e3..823608d0a750584005a0656a6ac3f39aef6c6348 100644 (file)
@@ -69,8 +69,9 @@ abstract class PveNodesLxcConfigModel
   Map<String, dynamic> get pending;
 
   dynamic getPending(String field) {
-    if (pending == null || pending.isEmpty)
+    if (pending == null || pending.isEmpty) {
       throw StateError('No pending values available');
+    }
     if (pending[field] != null && pending[field]['pending'] != null) {
       return pending[field]['pending'];
     }
index d3f27e2ee4eea934367ea2bbd72b4eb84794553e..a697a75b444c656bcfe6badbaec8d8c98e83540d 100644 (file)
@@ -106,8 +106,9 @@ abstract class PveNodesQemuConfigModel
   Map<String, dynamic> get pending;
 
   dynamic getPending(String field) {
-    if (pending == null || pending.isEmpty)
+    if (pending == null || pending.isEmpty) {
       throw StateError('No pending values available');
+    }
     if (pending[field] != null && pending[field]['pending'] != null) {
       return pending[field]['pending'];
     }