Skip to content
Snippets Groups Projects
Commit 53202b9e authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Avoid print calls in production code

parent ac129723
No related branches found
No related tags found
1 merge request!6Resolve "Avoid print calls in production code"
Pipeline #5248 passed
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.5 app.versionName=0.0.6
app.versionCode=5 app.versionCode=6
Avoid print calls in production code.
Supprime les appels à print dans le code de production.
...@@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; ...@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:unicons/unicons.dart'; import 'package:unicons/unicons.dart';
import 'package:stopmotion/utils/picture_storage.dart'; import 'package:stopmotion/utils/picture_storage.dart';
import 'package:stopmotion/utils/tools.dart';
class TakePictureWidget extends StatefulWidget { class TakePictureWidget extends StatefulWidget {
const TakePictureWidget({super.key}); const TakePictureWidget({super.key});
...@@ -71,14 +72,14 @@ class TakePictureWidgetState extends State<TakePictureWidget> { ...@@ -71,14 +72,14 @@ class TakePictureWidgetState extends State<TakePictureWidget> {
try { try {
if ((controller != null) && (controller!.value.isInitialized)) { if ((controller != null) && (controller!.value.isInitialized)) {
final XFile image = await controller!.takePicture(); final XFile image = await controller!.takePicture();
print('image.path: ${image.path}'); printlog('image.path: ${image.path}');
debug.add('image.path: ${image.path}'); debug.add('image.path: ${image.path}');
File savedFile = await storage!.writeCounter(File(image.path)); File savedFile = await storage!.writeCounter(File(image.path));
debug.add('image.path: ${image.path}'); debug.add('image.path: ${image.path}');
String imagePath = savedFile.path; String imagePath = savedFile.path;
print('imagePath: $imagePath'); printlog('imagePath: $imagePath');
debug.add('imagePath: $imagePath'); debug.add('imagePath: $imagePath');
previousImages.add(imagePath); previousImages.add(imagePath);
...@@ -88,7 +89,7 @@ class TakePictureWidgetState extends State<TakePictureWidget> { ...@@ -88,7 +89,7 @@ class TakePictureWidgetState extends State<TakePictureWidget> {
debug.add('error: $e'); debug.add('error: $e');
setState(() {}); setState(() {});
print(e); printlog(e.toString());
} }
}, },
), ),
......
...@@ -3,6 +3,8 @@ import 'dart:io'; ...@@ -3,6 +3,8 @@ import 'dart:io';
import 'package:path/path.dart'; import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:stopmotion/utils/tools.dart';
class PictureStorage { class PictureStorage {
Future<String> get _localPath async { Future<String> get _localPath async {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
...@@ -20,7 +22,7 @@ class PictureStorage { ...@@ -20,7 +22,7 @@ class PictureStorage {
try { try {
return await sourceFile.rename(newPath); return await sourceFile.rename(newPath);
} on FileSystemException catch (e) { } on FileSystemException catch (e) {
print('Found exception while moving file: $e'); printlog('Found exception while moving file: $e');
final newFile = await sourceFile.copy(newPath); final newFile = await sourceFile.copy(newPath);
await sourceFile.delete(); await sourceFile.delete();
return newFile; return newFile;
......
import 'package:flutter/foundation.dart';
void printlog(String message) {
if (!kReleaseMode) {
debugPrint(message);
}
}
...@@ -45,10 +45,10 @@ packages: ...@@ -45,10 +45,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: camera_platform_interface name: camera_platform_interface
sha256: fceb2c36038b6392317b1d5790c6ba9e6ca9f1da3031181b8bea03882bf9387a sha256: a250314a48ea337b35909a4c9d5416a208d736dcb01d0b02c6af122be66660b0
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.7.3" version: "2.7.4"
camera_web: camera_web:
dependency: transitive dependency: transitive
description: description:
...@@ -85,10 +85,10 @@ packages: ...@@ -85,10 +85,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: cross_file name: cross_file
sha256: "74a4727e030347edff3b6e5256b7fb0c3de8af8ed278e6c56718760786a1fa40" sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.4" version: "0.3.4+1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
...@@ -308,10 +308,10 @@ packages: ...@@ -308,10 +308,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: provider name: provider
sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.1" version: "6.1.2"
shared_preferences: shared_preferences:
dependency: transitive dependency: transitive
description: description:
......
...@@ -3,7 +3,7 @@ description: stop motion assistant ...@@ -3,7 +3,7 @@ description: stop motion assistant
publish_to: 'none' publish_to: 'none'
version: 0.0.5+5 version: 0.0.6+6
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment