public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements
Date: Fri, 21 Aug 2026 15:07:16 +0200	[thread overview]
Message-ID: <20260821130718.330515-2-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260821130718.330515-1-s.shaji@proxmox.com>

Dart Linter rules recommend avoiding print statements [0]. To align with
this, surround the print calls with the kDebugMode constant.

- [0] https://dart.dev/tools/linter-rules/avoid_print

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 analysis_options.yaml                    | 1 -
 lib/bloc/proxmox_base_bloc.dart          | 8 +++++---
 lib/bloc/pve_file_selector_bloc.dart     | 5 ++++-
 lib/widgets/pve_console_menu_widget.dart | 5 ++++-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/analysis_options.yaml b/analysis_options.yaml
index 97fc1a8..b8bb85a 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -21,7 +21,6 @@ linter:
   # `// ignore_for_file: name_of_lint` syntax on the line or in the file
   # producing the lint.
   rules:
-    avoid_print: false
     library_private_types_in_public_api: false # we need to fix use of our PveBaseState mixin first
     # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule
 
diff --git a/lib/bloc/proxmox_base_bloc.dart b/lib/bloc/proxmox_base_bloc.dart
index c01ade1..32d116e 100644
--- a/lib/bloc/proxmox_base_bloc.dart
+++ b/lib/bloc/proxmox_base_bloc.dart
@@ -1,6 +1,6 @@
 import 'dart:async';
 
-import 'package:meta/meta.dart';
+import 'package:flutter/foundation.dart';
 import 'package:pve_flutter_frontend/bloc/proxmox_global_error_bloc.dart';
 import 'package:rxdart/rxdart.dart';
 
@@ -55,8 +55,10 @@ abstract class ProxmoxBaseBloc<E, S> {
 
   void _errorHandler(Object error, [StackTrace? stacktrace]) {
     ProxmoxGlobalErrorBloc().addError(error);
-    print(error);
-    print(stacktrace);
+    if (kDebugMode) {
+      print(error);
+      print(stacktrace);
+    }
   }
 
   @mustCallSuper
diff --git a/lib/bloc/pve_file_selector_bloc.dart b/lib/bloc/pve_file_selector_bloc.dart
index ed78ac4..83dada7 100644
--- a/lib/bloc/pve_file_selector_bloc.dart
+++ b/lib/bloc/pve_file_selector_bloc.dart
@@ -1,6 +1,7 @@
 import 'package:pve_flutter_frontend/bloc/proxmox_base_bloc.dart';
 import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
 import 'package:pve_flutter_frontend/states/pve_file_selector_state.dart';
+import 'package:flutter/foundation.dart';
 
 class PveFileSelectorBloc
     extends ProxmoxBaseBloc<PveFileSelectorEvent, PveFileSelectorState> {
@@ -48,7 +49,9 @@ class PveFileSelectorBloc
             latestState.nodeID, latestState.storageID!, event.volume!,
             delay: 5);
       } on ProxmoxApiException catch (e) {
-        print(e);
+        if (kDebugMode) {
+          print(e);
+        }
       }
       events.add(LoadStorageContent());
     }
diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart
index 86feac8..68364e7 100644
--- a/lib/widgets/pve_console_menu_widget.dart
+++ b/lib/widgets/pve_console_menu_widget.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
 import 'dart:io';
 import 'dart:async';
 
+import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:path_provider/path_provider.dart';
@@ -259,7 +260,9 @@ class PVEWebConsoleState extends State<PVEWebConsole> {
                   await settings
                       .rebuild((b) => b..trustedFingerprints.add(hash))
                       .toLocalStorage();
-                  print(settings.toJson());
+                  if (kDebugMode) {
+                    print(settings.toJson());
+                  }
                 }
 
                 final action = trust
-- 
2.47.3





  reply	other threads:[~2026-08-21 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 13:07 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule Shan Shaji
2026-08-21 13:07 ` Shan Shaji [this message]
2026-08-21 13:07 ` [PATCH proxmox_login_manager 1/1] cleanup: remove print statements Shan Shaji
2026-08-21 13:07 ` [PATCH proxmox_dart_api_client 1/1] cleanup: avoid " Shan Shaji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260821130718.330515-2-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal