CODEX
Log Driven Learning Flutter
an easier way to learn flutter!

Some famous book author stated that it takes 10,000 hours of deliberate practice to become an expert. That’s approximately 10 years. Do you have ten years to become an expert in flutter given that the hiring manager expects to get a flutter expert with the job ad and the interviews they give? No? There is an easier way to learn and use deliberate practice to learn flutter in 1000 hours rather than take 10,000 hours at ten years.
Background
Back when Kathy Sierra started her Head-First Series at OReilly most firms were still doing some type of software engineering training. But those days are long gone and yet it’s still the same exact format for the Head-First series in that still not advanced code examples.
And the Google Dart and Flutter SDK tutorials are the same way with no expert code. The problem with that is that the major difference between those that are brand new to development versus those coming from some other computer language and framework is not whether code is expert or not in levels of design and best practices.
The only difference between those two groups is the amount of coding practice in the number of applications they need to build to reach that 10,000 hours of flutter expertise. The beginners will have to do between 1000 and 2000 hours whereas those developers from other computer languages and frameworks only have to do about 1000 hours if they are exposed to a good expert application skeleton.
The other commonality is the way the logging practice is implemented in all the teaching-lessons!
Power of Logging Feedback
In self-learning do you have someone to hold your hand and immediately tell you when you are doing something wrong and then adjust your technique? A self-editor, if you will. No? If you are automatically setting up loggers per each dart file you write, then you will get such a self-editor pointing out your mistakes!
We have this nice Log function from the dart:developer package:
* `message`is the log message
* `time`(optional) is the timestamp
* `sequenceNumber`(optional) is a monotonically increasing sequence number
* `level`(optional) is the severity level (a value between 0 and 2000); see the`package:logging``Level`class for an overview of the possible values
* `name`(optional) is the name of the source of the log message
* `zone`(optional) the zone where the log was emitted
* `error`(optional) an error object associated with this log event
* `stackTrace`(optional) a stack trace associated with this log eventThe name, in this case, is the NAME of a logger. But, it’s not much of use by itself. Now, let me show you some details from the dart language package you should be paring the log function with, ie the package dart:logging:
https://pub.dev/packages/logging
There is a priority to levels of :
LEVEL ALL 0
LEVEL FINEST 300
LEVEL FINER 400
LEVEL FINE 500
LEVEL CONFIG 700
LEVEL INFO 800
LEVEL WARNING 900
LEVEL SEVERE 1000
LEVEL SHOUT 1200
LEVEL OFF 2000The Logging Dart Package does these things: 1. Sets up Loggers that can be either singletons or non-singletons in either loose non-collections or collections of hierarchical loggers. 2. Set’s up streaming the log events to an output stream. 3. Allow changing of Levels of a specific logger if hierarchicalLoggingEnabled is set to true. When its false you never have to set a level of a non-root logger as non-root loggers in that case default to the level of the root logger.
You can think of Streams of Events as the RX-way of implementing an event-bus in a good practices way instead of the anti-pattern way.
What this means for our learning by deliberate practice of logging is that: 1. We can set the Root Logger, ie the null name string logger, to LEVEL.ALL and then use Logger(ourUniqueName) as our logger for each dart file as it will pick up the same level as the root logger level setting. 2. If you need to sort the vie log names in the output then you set hierachicalLoggingEnabled on the root logger and set an output-appender for each non-root logger.
AND, obviously, someone else saw this as well, ie the package author of the logging_apppenders package, as that package is designed specifically to set the root logger for log output with this setup in mind, and in fact the readme example is exactly that:
https://pub.dev/packages/logging_appenders
In my flutter_deep_dive expert flutter application skeleton I will only have these lines to setup my loggers:
loggerSetUp{
if(kDebugMode){
PrintAppender.setupLogging();
PrintAppender(formatter: const ColorFormatter())
..attachToLogger(Logger.root);} }
Basically, that means any of my logger(uniqueName) calls in release mode are not going to any output as we have not set the onRecord target of the root logger. And that is somewhat fine as we will catch our app exceptions via Firebase Crashanalytics and the Zone exception handling.
Then in each dart file, you can as a global this:
final Logger myLogger = Logger('myDartFilename');That will be a singleton according to the Logging package docs and is totally fine as we never ever unit test loggers directly.
Conclusion
I wanted a different way to set up my expert flutter application skeleton, flutter_deep_dive:
https://gitlab.com/fred.grott/flutter_deep_dive
While I have some more commits to get the Log Driven Learning Flutter set up, you should bookmark it as those commits will be pushed to the master branch this weekend.
This git repo will then serve as the hub where I will be linking all my practice repos practicing the techniques that make up my first flutter application development book that will be published this fall. Together we will spend 1000 to 2000 hours and all of us will become experts at Flutter using Log Driven Learning Flutter.
Resources
Malcom Gladwell’s Outliers(@wikipedia-summary)https://en.wikipedia.org/wiki/Outliers_(book)
flutter_deep_dive(my expert flutter app skeleton@gitlab)https://gitlab.com/fred.grott/flutter_deep_dive
General Flutter and Dart resources:
Flutter Community Resources https://flutter.dev/community
Flutter SDK https://flutter.dev/docs/get-started/install
Android Studio IDE https://developer.android.com/studio
MS’s Visual Studio Code https://code.visualstudio.com/
Flutter Docs https://flutter.dev/docs
Dart Docs https://dart.dev/guides
Google Firebase Mobile Device TestLab https://firebase.google.com/docs/test-lab
Trademark Notice
Google LLC owns the following trademarks; Dart, Flutter, Android, Roboto, Noto. Apple Inc owns the trademarks iOS, MacOSX, Swift, and Objective-C. Apple Inc owns trademarks to their fonts of SF Pro, Sf Compact, SF mono, and New York. JetBeans Inc owns the trademarks to JetBeans, IntelliJ, and Kotlin. Oracle Inc owns the Java trademark. Microsoft Inc owns the trademarks of MS Windows OS and Powershell. Gradle is a trademark of Gradle Inc. The Git Project owns the trademark to Git. Linux Foundation owns the trademark of Linux. Smartphone OEM’s own trademarks to their mobile phone product names. To the best of my ability, I follow the brand and usage guidelines with the above-mentioned trademarks.
About Fred Grott
I’m the crazy SOB who as a former android mobile developer is starting to write about flutter mobile app development, design, and life(see Eff COVID and GOP https://fredgrott.medium.com/eff-covid-and-the-gop-e912db0548b8). Will I reach the pivotal One Million Medium monthly viewers mark? Sit back and watch it happen. Find me on these social platforms:





