talker 2.1.0 talker: ^2.1.0 copied to clipboard
Advanced error handler and logger package for flutter and dart apps
Advanced error handler and logger for dart and flutter apps ☎️
Log your app actions, catch and handle exceptions and errors, show alerts and share log reports
Show some ❤️ and star the repo to support the project!
Motivation #
🚀 The main goal of the project provide ability to understand where the error occurs in a short time
✅ Can work with different state managements
✅ Can work with any crash reporting tool (Firebase Crashlytics, Sentry, Your own, etc)
✅ Flutter app logs UI output at screen
✅ Integrated logs and exceptions history
✅ Showing UI exception alerts
Packages #
Talker is designed for any level of customization.
Package | Version | Description |
---|---|---|
talker | Main dart package for make logs handle exceptions. | |
talker_flutter | Error handler and logger for Flutter applications | |
talker_logger | Customizable pretty logger for dart/flutter apps | |
talker_dio_logger | Customizable pretty logger for logging dio http calls |
Get Started #
Follow these steps to the coolest experience in error handling
Add dependency #
dependencies:
talker: ^2.1.0
Easy to use #
You can use Talker instance everywhere in your app
Simple and concise syntax will help you with this
final talker = Talker();
// Handle exceptions and errors
try {
// your code...
} on Exception catch (e, st) {
talker.handle(e, st, 'Exception with');
}
// Log your app info
talker.info('App is started');
talker.critical('❌ Houston, we have a problem!');
talker.error('🚨 The service is not available');
More examples you can get here
❗️ Attention ❗️ #
Logs are truncated / cut by the console #
Latest Flutter stable release have print method bug issues/110236
But with Talker you can solve it with passing your own output/print method
If you want to see full logs in console - pass debugPrint as ouput callback method in Talker constructor
final talker = Talker(
loggerOutput: debugPrint,
);
iOS logs colors #
There is a problem with the color palette of logs when launching the app on iOS. In this case, the console cannot read the ansi colors that are used by the library.
For disable colors in iOS application you can setup this loggerSettings field
final talker = Talker(
loggerSettings: TalkerLoggerSettings(
enableColors: !Platform.isIOS,
),
);
⚙️ Customization #
Configure the error handler and logger for yourself
final talker = Talker(
/// Your own observers to handle errors's exception's and log's
/// like Crashlytics or Sentry observer
observers: [],
settings: const TalkerSettings(
/// You can enable/disable all talker processes with this field
enabled: true,
/// You can enable/disable saving logs data in history
useHistory: true,
/// Length of history that saving logs data
maxHistoryItems: 100,
/// You can enable/disable console logs
useConsoleLogs: true,
),
/// Setup your implementation of logger
logger: TalkerLogger(),
///etc...
);
More examples you can get here
Talker Flutter #
Often you need to check what happening in the application when there is no console at hand.
There is a talker_flutter package for this situations.
Get Started with talker_flutter #
Follow these steps to implement talker_flutter in your application
Add dependency #
dependencies:
talker_flutter: ^2.0.6
Easy to use #
You can use TalkerScreen everywhere in your app At Screen, BottomSheet, ModalDialog, etc...
final talker = Talker(
loggerOutput: debugPrint,
);
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => TalkerScreen(talker: talker),
)
);
TalkerScreen usage example
TalkerWrapper #
In addition to the above,
talker_flutter is able to show default and custom error messages and another status messages
final talker = Talker(
loggerOutput: debugPrint,
);
TalkerWrapper(
talker: talker,
options: const TalkerWrapperOptions(
enableErrorAlerts: true,
),
child: /// Application or the screen where you need to show messages
),
In order to understand in more details - you can check this article "Showing Flutter custom error messages"
TalkerWrapper usage example
See full application example with BLoC and navigation here
The talker_flutter package have a lot of another widgets like TalkerBuilder, TalkerListener, etc. You can find all of them in code documentation.
Coverage #
Error handling is a very important task
You need to choose carefully if you want to use a package for exceptions handling solution
Therefore, the project is 100% covered by tests
Additional information #
The project is under development and ready for your pull-requests and issues 👍
Thank you for support ❤️
For help getting started with 😍 Flutter, view online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.