Skip to content

Commit

Permalink
chore: print log only when debug mode (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon authored Dec 10, 2024
1 parent 1cd8f49 commit 0be31ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/provider/streaming/incoming_message_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

Expand All @@ -15,7 +15,9 @@ Stream<IncomingMessage> incomingMessage(Ref ref, Account account) {
final webSocketChannel = ref.watch(webSocketChannelProvider(account));
return webSocketChannel.stream.map((msg) {
final message = jsonDecode(msg as String);
debugPrint('webSocketChannel: $msg');
if (kDebugMode) {
debugPrint('webSocketChannel: $msg');
}
return IncomingMessage.fromJson(message as Map<String, dynamic>);
});
}
2 changes: 1 addition & 1 deletion lib/provider/streaming/incoming_message_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions lib/util/compress_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Future<Uint8List?> compressImage(Uint8List image, String? type) async {
return resized;
}
} catch (e) {
debugPrint(e.toString());
if (kDebugMode) {
debugPrint(e.toString());
}
}
} else {
try {
Expand All @@ -82,7 +84,9 @@ Future<Uint8List?> compressImage(Uint8List image, String? type) async {
return resized.rawBytes;
}
} catch (e) {
debugPrint(e.toString());
if (kDebugMode) {
debugPrint(e.toString());
}
}
}
return null;
Expand Down

0 comments on commit 0be31ad

Please sign in to comment.