ToolsHelper class

A helper class containing utility functions to manage common tasks and ensure efficient execution of actions based on conditions, such as controlling the frequency of repeated actions and ensuring internet connectivity before executing a function.

The ToolsHelper class provides simple yet powerful methods to manage recurring actions and ensure that specific actions are only performed under certain conditions, improving performance and reliability of the app.

Main Features:

  • Control the execution of actions to prevent repeated triggers within a specific time frame.
  • Ensure internet connectivity before executing functions, with automatic checks for network availability.

This class is designed to be used across various parts of your app where you need to control repeated actions and network-dependent operations.

Example usage:

ToolsHelper.stopRepeating(action: () => performAction(), duration: Duration(seconds: 15));
ToolsHelper.triggerWithInternet(() => fetchDataFromServer());

Constructors

ToolsHelper()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

stopRepeating({dynamic action()?, Duration? duration}) bool
Ensures that the provided action is executed only once within a specified duration. If the action is triggered again within that duration, it will be ignored.
triggerWithInternet(dynamic action(), {bool? isGoogleInternetCheck}) Future<void>
A utility method to trigger a function if the device has an active internet connection.