Ahmed Masoud

enable logs on debug instead of always

  1 +import 'package:flutter/foundation.dart';
1 import 'package:flutter/widgets.dart'; 2 import 'package:flutter/widgets.dart';
2 3
3 import 'log.dart'; 4 import 'log.dart';
@@ -9,6 +10,6 @@ abstract class GetInterface { @@ -9,6 +10,6 @@ abstract class GetInterface {
9 SmartManagement smartManagement = SmartManagement.full; 10 SmartManagement smartManagement = SmartManagement.full;
10 RouterDelegate? routerDelegate; 11 RouterDelegate? routerDelegate;
11 RouteInformationParser? routeInformationParser; 12 RouteInformationParser? routeInformationParser;
12 - bool isLogEnable = true; 13 + bool isLogEnable = kDebugMode;
13 LogWriterCallback log = defaultLogWriterCallback; 14 LogWriterCallback log = defaultLogWriterCallback;
14 } 15 }
1 import 'dart:developer' as developer; 1 import 'dart:developer' as developer;
2 import 'get_main.dart'; 2 import 'get_main.dart';
3 3
4 -///Voidcallback from logs 4 +///VoidCallback from logs
5 typedef LogWriterCallback = void Function(String text, {bool isError}); 5 typedef LogWriterCallback = void Function(String text, {bool isError});
6 6
7 /// default logger from GetX 7 /// default logger from GetX
@@ -52,7 +52,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -52,7 +52,7 @@ class GetCupertinoApp extends StatelessWidget {
52 this.onReady, 52 this.onReady,
53 this.getPages, 53 this.getPages,
54 this.opaqueRoute, 54 this.opaqueRoute,
55 - this.enableLog, 55 + this.enableLog = kDebugMode,
56 this.logWriterCallback, 56 this.logWriterCallback,
57 this.popGesture, 57 this.popGesture,
58 this.transitionDuration, 58 this.transitionDuration,
@@ -154,7 +154,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -154,7 +154,7 @@ class GetCupertinoApp extends StatelessWidget {
154 this.onInit, 154 this.onInit,
155 this.onReady, 155 this.onReady,
156 this.onDispose, 156 this.onDispose,
157 - this.enableLog, 157 + this.enableLog = kDebugMode,
158 this.logWriterCallback, 158 this.logWriterCallback,
159 this.popGesture, 159 this.popGesture,
160 this.smartManagement = SmartManagement.full, 160 this.smartManagement = SmartManagement.full,
@@ -55,7 +55,7 @@ class GetMaterialApp extends StatelessWidget { @@ -55,7 +55,7 @@ class GetMaterialApp extends StatelessWidget {
55 this.defaultTransition, 55 this.defaultTransition,
56 this.getPages, 56 this.getPages,
57 this.opaqueRoute, 57 this.opaqueRoute,
58 - this.enableLog, 58 + this.enableLog = kDebugMode,
59 this.logWriterCallback, 59 this.logWriterCallback,
60 this.popGesture, 60 this.popGesture,
61 this.transitionDuration, 61 this.transitionDuration,
@@ -170,7 +170,7 @@ class GetMaterialApp extends StatelessWidget { @@ -170,7 +170,7 @@ class GetMaterialApp extends StatelessWidget {
170 this.onInit, 170 this.onInit,
171 this.onReady, 171 this.onReady,
172 this.onDispose, 172 this.onDispose,
173 - this.enableLog, 173 + this.enableLog = kDebugMode,
174 this.logWriterCallback, 174 this.logWriterCallback,
175 this.popGesture, 175 this.popGesture,
176 this.smartManagement = SmartManagement.full, 176 this.smartManagement = SmartManagement.full,
@@ -298,13 +298,15 @@ class GetMaterialApp extends StatelessWidget { @@ -298,13 +298,15 @@ class GetMaterialApp extends StatelessWidget {
298 ) 298 )
299 : MaterialApp( 299 : MaterialApp(
300 key: _.unikey, 300 key: _.unikey,
301 - navigatorKey:  
302 - (navigatorKey == null ? Get.key : Get.addKey(navigatorKey!)), 301 + navigatorKey: (navigatorKey == null
  302 + ? Get.key
  303 + : Get.addKey(navigatorKey!)),
303 scaffoldMessengerKey: scaffoldMessengerKey, 304 scaffoldMessengerKey: scaffoldMessengerKey,
304 home: home, 305 home: home,
305 routes: routes ?? const <String, WidgetBuilder>{}, 306 routes: routes ?? const <String, WidgetBuilder>{},
306 initialRoute: initialRoute, 307 initialRoute: initialRoute,
307 - onGenerateRoute: (getPages != null ? generator : onGenerateRoute), 308 + onGenerateRoute:
  309 + (getPages != null ? generator : onGenerateRoute),
308 onGenerateInitialRoutes: (getPages == null || home != null) 310 onGenerateInitialRoutes: (getPages == null || home != null)
309 ? onGenerateInitialRoutes 311 ? onGenerateInitialRoutes
310 : initialRoutesGenerate, 312 : initialRoutesGenerate,
@@ -339,5 +341,6 @@ class GetMaterialApp extends StatelessWidget { @@ -339,5 +341,6 @@ class GetMaterialApp extends StatelessWidget {
339 shortcuts: shortcuts, 341 shortcuts: shortcuts,
340 scrollBehavior: scrollBehavior, 342 scrollBehavior: scrollBehavior,
341 // actions: actions, 343 // actions: actions,
342 - )); 344 + ),
  345 + );
343 } 346 }