flutter_platform_widgets
flutter_platform_widgets copied to clipboard
approach on logging
Do we have an approach to logging?
I just started auditing the plugins I use to see which ones log and which ones do not and found flutter platform widgets do not.
In fact, we have embedded print which is not very cool:
https://github.com/stryder-dev/flutter_platform_widgets/blob/master/lib/src/widget_base.dart
in that code instead, it should be
Widget build(BuildContext context) {
if (isMaterial(context)) {
return createMaterialWidget(context);
} else if (isCupertino(context)) {
return createCupertinoWidget(context);
}
return throw new UnsupportedError(
log( 'This platform is not supported: $defaultTargetPlatform'));
}
One of the approaches we could use is using the logging package to set up a named logger of 'FPW' and then do a logger.error('This platform is not supported: $defaultTargetPlatform')
Not too keen on introducing a dependency, particularly since there is a solution natively from flutter. Additionally it is a matter of opinion as to when to log. Some packages I use do logging and they get in the way (noise) of my application logging that I control.