LoggerService class

Service for managing logs (add, clear, persist) using Riverpod state.

Constructors

LoggerService.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
ref → NotifierProviderRef<List<DevLogModel>>
The Ref from the provider associated with this Notifier.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state List<DevLogModel>
The value currently exposed by this Notifier.
getter/setter pairinherited
stateOrNull List<DevLogModel>?
The value currently exposed by this Notifier.
no setterinherited

Methods

addApiLog({required String heading, required String content, required String method, required String url, required Map<String, dynamic> headers, dynamic body, int? statusCode, Duration? timings, int? memoryUsage}) → void
addDebugLog({required String heading, required String content, required DebugLogLevel level}) → void
Add a debug log entry.
addLog({required String heading, required String content}) → void
Add a generic log entry.
build() List<DevLogModel>
Initialize a Notifier.
clearLogs() → void
listenSelf(void listener(List<DevLogModel>? previous, List<DevLogModel> next), {void onError(Object error, StackTrace stackTrace)?}) → void
Listens to changes on the value exposed by this provider.
inherited
loadPersistedLogs() → void
Load logs from persistence on initialization
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateShouldNotify(List<DevLogModel> previous, List<DevLogModel> next) bool
A method invoked when the state exposed by this Notifier changes. It compares the previous and new value, and return whether listeners should be notified.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

initPersistenceIfNeeded(LoggerConfig config) Future<void>
Initialize Hive persistence if enabled in config.