Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/custom_backend/lib/backend/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ abstract class Backend {
);

if (response.statusCode == 200) {
print('Response body: ${response.body}');
debugSaveToFileObject('response-body', response.body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Debug code with side effects like file I/O should be guarded to only run in debug mode. This prevents creating debug files in release builds, which can be an unexpected side effect for users and could impact performance. Please wrap this call in an if (kDebugMode) block. You will also need to add import 'package:flutter/foundation.dart'; at the top of the file.

Suggested change
debugSaveToFileObject('response-body', response.body);
if (kDebugMode) {
debugSaveToFileObject('response-body', response.body);
}

return response.body;
} else {
throw Exception('Failed to send request: ${response.body}');
Expand Down
Loading