isEmpty method

bool isEmpty(
  1. String data
)

Checks if the provided data is empty.

Returns true if data is an empty string, otherwise returns false.

Example:

bool empty = isEmpty(''); // Returns true
bool notEmpty = isEmpty('Hello'); // Returns false

Note: This function considers a string with length 0 as empty.

Example:

bool empty = isEmpty(' '); // Returns false

Implementation

bool isEmpty(String data) {
  if (data.isEmpty) {
    return true;
  }
  return false;
}