Ahmed Masoud

enable logs on debug instead of always

import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'log.dart';
... ... @@ -9,6 +10,6 @@ abstract class GetInterface {
SmartManagement smartManagement = SmartManagement.full;
RouterDelegate? routerDelegate;
RouteInformationParser? routeInformationParser;
bool isLogEnable = true;
bool isLogEnable = kDebugMode;
LogWriterCallback log = defaultLogWriterCallback;
}
... ...
import 'dart:developer' as developer;
import 'get_main.dart';
///Voidcallback from logs
///VoidCallback from logs
typedef LogWriterCallback = void Function(String text, {bool isError});
/// default logger from GetX
... ...
... ... @@ -52,7 +52,7 @@ class GetCupertinoApp extends StatelessWidget {
this.onReady,
this.getPages,
this.opaqueRoute,
this.enableLog,
this.enableLog = kDebugMode,
this.logWriterCallback,
this.popGesture,
this.transitionDuration,
... ... @@ -154,7 +154,7 @@ class GetCupertinoApp extends StatelessWidget {
this.onInit,
this.onReady,
this.onDispose,
this.enableLog,
this.enableLog = kDebugMode,
this.logWriterCallback,
this.popGesture,
this.smartManagement = SmartManagement.full,
... ...
... ... @@ -55,7 +55,7 @@ class GetMaterialApp extends StatelessWidget {
this.defaultTransition,
this.getPages,
this.opaqueRoute,
this.enableLog,
this.enableLog = kDebugMode,
this.logWriterCallback,
this.popGesture,
this.transitionDuration,
... ... @@ -170,7 +170,7 @@ class GetMaterialApp extends StatelessWidget {
this.onInit,
this.onReady,
this.onDispose,
this.enableLog,
this.enableLog = kDebugMode,
this.logWriterCallback,
this.popGesture,
this.smartManagement = SmartManagement.full,
... ... @@ -298,13 +298,15 @@ class GetMaterialApp extends StatelessWidget {
)
: MaterialApp(
key: _.unikey,
navigatorKey:
(navigatorKey == null ? Get.key : Get.addKey(navigatorKey!)),
navigatorKey: (navigatorKey == null
? Get.key
: Get.addKey(navigatorKey!)),
scaffoldMessengerKey: scaffoldMessengerKey,
home: home,
routes: routes ?? const <String, WidgetBuilder>{},
initialRoute: initialRoute,
onGenerateRoute: (getPages != null ? generator : onGenerateRoute),
onGenerateRoute:
(getPages != null ? generator : onGenerateRoute),
onGenerateInitialRoutes: (getPages == null || home != null)
? onGenerateInitialRoutes
: initialRoutesGenerate,
... ... @@ -339,5 +341,6 @@ class GetMaterialApp extends StatelessWidget {
shortcuts: shortcuts,
scrollBehavior: scrollBehavior,
// actions: actions,
));
),
);
}
... ...