Andy Whitt
1 min readOct 6, 2020

--

Regarding print/debugPrint, I use this simple function, specifying a bool to toggle printing logs.

Always looking for better ways...

---------- display_logs.dart

import 'dart:developer' as developer;

void displayLog(String fileName, String className, String message) {

developer.log('(' + fileName + ')' + ' ***** ' + message,

name: className,

);

}

---------- example usage

import '../utilities/display_logs.dart';

const _dartFileName = '<file name>.dart'

if (Constants.DISPLAY_LOGS)

displayLog(_dartFileName, this.runtimeType.toString(),

'signOut Failed, error: ${error.toString()}');

--

--

Andy Whitt
Andy Whitt

Written by Andy Whitt

0 Followers

Mobile application developer. Began writing software almost 40 years ago. Shifting all development focus to Flutter.

No responses yet