DevLoggerUI class
The main API Logger singleton class for managing API logging, overlays, and events.
This class provides initialization, event handling, and overlay management for API logging.
- Inheritance
-
- Object
- DevLoggerUIAbstract
- DevLoggerUI
- Mixed-in types
Properties
- detector ↔ ShakeDetector?
-
The shake detector instance.
getter/setter pair
-
getRequestModels
↔ List<
RequestModel> Function()? -
Function to retrieve the list of request models.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLogCurl ↔ bool
-
Whether curl logging is enabled.
getter/setter pairinherited
- isLogEnabled ↔ bool
-
Whether logging is enabled.
getter/setter pairinherited
- isOnlyShowErrorApis ↔ bool
-
Whether to only show error APIs.
getter/setter pairinherited
- isShowedApiScreen ↔ bool
-
Whether the API screen is currently shown.
getter/setter pair
- isShowHiddenApis ↔ bool
-
Whether hidden APIs should be shown.
getter/setter pairinherited
- isShowNormalError ↔ bool
-
Whether normal errors should be shown.
getter/setter pairinherited
- isShowUIError ↔ bool
-
Whether UI errors should be shown.
getter/setter pairinherited
-
listeners
↔ List<
void Function(List< BaseModel> requestModels)> -
Listeners to be notified when the list of requests changes.
getter/setter pairinherited
-
mapRequestOptions
↔ Map<
RequestOptions, RequestModel> -
Stores request models for quick lookup by
RequestOptions.getter/setter pairinherited -
mapsRequest
↔ Map<
RequestOptions, RequestModel> -
Stores all request models by their
RequestOptions.getter/setter pairinherited -
mockApis
↔ Map<
String, MockApi> -
Stores all mock APIs by their original URL.
getter/setter pairinherited
-
models
↔ List<
BaseModel> -
The list of models tracked by the logger.
getter/setter pairinherited
-
The navigator key for navigation operations.
getter/setter pairinherited
-
openTypes
↔ List<
OpenType> -
List of open types for showing the API logger overlay.
getter/setter pair
-
removeApis
↔ List<
String> -
List of APIs to be hidden.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- saveManager ↔ SaveManager
-
The save manager for persistent storage.
getter/setter pairinherited
- startWaitTurnOn ↔ int?
-
getter/setter pair
- valueFromResponse ↔ ValueFromResponse
-
Strategies for extracting values from API responses.
getter/setter pairinherited
- waitTurnOnTime ↔ int
-
getter/setter pair
Methods
-
addEmail(
String email) → void -
Adds a new email address to the list and persists the change.
inherited
-
addErrorListener(
OnErrorModelChanged listener) → void -
Adds a listener for error model changes.
inherited
-
addHideApi(
String api) → void -
Adds an API to the hidden list and persists the change.
inherited
-
addListener(
void listener(List< BaseModel> requestModels)) → void -
Adds a listener for request model changes.
inherited
-
addMapRequestOption(
RequestOptions options, RequestModel model) → void -
Adds a request model to the map for the given
RequestOptions.inherited -
addNormalError(
dynamic error, StackTrace stackTrace) → void -
Adds a normal (non-UI) error and notifies listeners.
inherited
-
addOnNewErrorFiredListener(
OnNewError listener) → void -
Adds a listener for new Flutter errors.
inherited
-
addOrUpdateMockApi(
MockApi mockApi) → void -
Adds or updates a mock API and associates it with the corresponding request model.
inherited
-
addRequest(
RequestModel requestModel, RequestOptions options) → void -
Adds a new request model and notifies listeners.
inherited
-
addRouteApiScreenListener(
OnRouteApiScreen listener) → void - Adds a listener for API screen route events.
-
addUIError(
FlutterErrorDetails error) → void -
Adds a UI error and notifies listeners.
inherited
-
calcContentLength(
Map< String, dynamic> headers) → int -
Calculates the content length from HTTP headers.
inherited
-
checkHasMockApi(
String? originalUrl) → bool -
Checks if a mock API exists for the given original URL.
inherited
-
clear(
{bool isClearSavedData = false}) → void - Clears all logger data, optionally clearing saved data as well.
-
clearEmails(
{bool isClearSavedData = false}) → void -
Clears all email addresses and the selected email, optionally clearing saved data as well.
inherited
-
clearHiddenApis(
{bool isClearSavedData = false}) → void -
Clears all hidden APIs, optionally clearing saved data as well.
inherited
-
clearMockApis(
{bool isClearSavedData = false}) → void -
Clears all mock APIs, optionally clearing saved data as well.
inherited
-
clearRequests(
) → void -
Clears all request models and notifies listeners.
inherited
-
completeRequest(
Response response) → void -
Completes a request with a
Responseand notifies listeners.inherited -
completeRequestByError(
DioException error) → void -
Completes a request with a
DioExceptionand notifies listeners.inherited -
completeRequestByOtherError(
Exception error, RequestOptions options) → void -
Completes a request with an Exception and notifies listeners.
inherited
-
didChangeAccessibilityFeatures(
) → void -
Called when the system changes the set of currently active accessibility
features.
inherited
-
didChangeAppLifecycleState(
AppLifecycleState state) → void -
Handles app lifecycle state changes.
override
-
didChangeLocales(
List< Locale> ? locales) → void -
Called when the system tells the app that the user's locale has
changed. For example, if the user changes the system language
settings.
inherited
-
didChangeMetrics(
) → void -
Called when the application's dimensions change. For example,
when a phone is rotated.
inherited
-
didChangePlatformBrightness(
) → void -
Called when the platform brightness changes.
inherited
-
didChangeTextScaleFactor(
) → void -
Called when the platform's text scale factor changes.
inherited
-
didChangeViewFocus(
ViewFocusEvent event) → void -
Called whenever the PlatformDispatcher receives a notification that the
focus state on a view has changed.
inherited
-
didHaveMemoryPressure(
) → void -
Called when the system is running low on memory.
inherited
-
didPopRoute(
) → Future< bool> -
Called when the system tells the app to pop the current route, such as
after a system back button press or back gesture.
inherited
-
didPushRoute(
String route) → Future< bool> -
Called when the host tells the application to push a new route onto the
navigator.
inherited
-
didPushRouteInformation(
RouteInformation routeInformation) → Future< bool> -
Called when the host tells the application to push a new
RouteInformation and a restoration state onto the router.
inherited
-
didRequestAppExit(
) → Future< AppExitResponse> -
Called when a request is received from the system to exit the application.
inherited
-
editEmail(
String newEmail, String oldEmail) → void -
Edits an existing email address and persists the change.
inherited
-
fireEvent(
) → void -
Notifies all listeners of request model changes.
inherited
-
fireOnRouteApiScreen(
bool isShowed) → void - Notifies listeners when the API screen is shown or hidden.
-
getErrorRequests(
) → List< RequestModel> -
Returns a list of requests that are considered errors by the API response.
inherited
-
getHttpErrorRequests(
) → List< RequestModel> -
Returns a list of requests with HTTP error codes (not 2xx).
inherited
-
getInProgressRequests(
) → List< RequestModel> -
Returns a list of requests that are still in progress.
inherited
-
getMockApi(
String url) → MockApi? -
Retrieves a mock API by URL.
inherited
-
getRequestModel(
RequestOptions options) → RequestModel? -
Retrieves a request model by
RequestOptions.inherited -
getSelectedEmail(
) → String? -
Gets the currently selected email address.
inherited
-
getSendEmails(
) → List< String> -
Gets the list of email addresses used for sending logs.
inherited
-
getSendEmailsFromCache(
) → Future< List< String> > -
Loads the list of email addresses and the selected email from persistent storage.
inherited
-
getUDID(
) → Future< String> - Gets the device UDID (Unique Device Identifier).
-
handleCancelBackGesture(
) → void -
Called when a predictive back gesture is canceled, indicating that no
navigation should occur.
inherited
-
handleCommitBackGesture(
) → void -
Called when a predictive back gesture is finished successfully, indicating
that the current route should be popped.
inherited
-
handleStartBackGesture(
PredictiveBackEvent backEvent) → bool -
Called at the start of a predictive back gesture.
inherited
-
handleStatusBarTap(
) → void -
Called when the user taps the status bar on iOS, to scroll a scroll
view to the top.
inherited
-
handleUpdateBackGestureProgress(
PredictiveBackEvent backEvent) → void -
Called when a predictive back gesture moves.
inherited
-
init(
{SaveManager? saveManager, bool isAutoStart = true, bool isLogCurl = true, List< OpenType> openTypes = const [OpenType.shake, OpenType.longPress, OpenType.button], int? waitTurnOnTime, Future<String?> sendText({required String body, required String email, required String title})?, ValueFromResponse? valueFromResponse}) → Future<void> - Initializes the API logger with configuration options.
-
initEmail(
SendTextFunction? sendText) → void -
Initializes the email manager with a send text function.
inherited
-
initErrorManager(
) → Future< void> -
Initializes error manager state from persistent storage.
inherited
-
initHiddenApi(
) → Future -
Initializes the hidden API manager and loads saved hidden APIs.
inherited
-
initMock(
{List< RequestModel> getRequestModels()?}) → Future<void> -
Initializes the mock API manager and loads saved mock APIs.
inherited
-
initRequestManager(
{MockApi? getMockApi(String url)?}) → void -
Initializes the request manager with a function to get mock APIs.
inherited
-
listenFlutterError(
OnNewError? onError) → void -
Registers a callback to listen for Flutter errors.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → void - Pauses the API logger and removes shake detection.
-
removeEmail(
String email) → void -
Removes an email address from the list and persists the change.
inherited
-
removeError(
ErrorModel model) → void -
Removes an error model and notifies listeners.
inherited
-
removeErrorListener(
OnErrorModelChanged listener) → void -
Removes a listener for error model changes.
inherited
-
removeListener(
void listener(List< BaseModel> requestModels)) → void -
Removes a listener for request model changes.
inherited
-
removeMockApi(
String originalUrl) → void -
Removes a mock API and disassociates it from request models.
inherited
-
removeOnNewErrorFiredListener(
OnNewError listener) → void -
Removes a listener for new Flutter errors.
inherited
-
removeRequestModel(
RequestOptions options) → RequestModel? -
Removes and returns a request model by
RequestOptions.inherited -
removeRouteApiScreenListener(
OnRouteApiScreen listener) → void - Removes a listener for API screen route events.
-
saveSelectedEmail(
) → Future< bool> -
Persists the selected email address.
inherited
-
sendText(
{required String body, required String title, required String email, String? url}) → Future< String?> -
Sends text via email using the configured send text function.
inherited
-
setSelectedEmail(
String? email) → void -
Sets the selected email address and persists the change.
inherited
-
showApiScreen(
{bool isSafe = true}) → Future - Shows the API logger overlay screen.
-
start(
) → Future< void> - Starts the API logger and adds necessary observers.
-
stop(
) → void - Stops the API logger, removes observers, and clears data.
-
toString(
) → String -
A string representation of this object.
inherited
-
waitForTurnOff(
) → void - Waits for the logger to be turned off via shake gesture.
-
waitForTurnOn(
) → void - Waits for the logger to be turned on via shake gesture.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → DevLoggerUI
-
Gets the singleton instance of DevLoggerUI.
no setter
Static Methods
-
builder(
{TransitionBuilder? builder}) → TransitionBuilder - Returns a TransitionBuilder for wrapping the app with the API logger overlay.
Constants
- turnOnLoggerKey → const String
- Key for saving the logger enable state.