text method

String text()

Casts data to a String and returns it.

Throws LuckyParseException if data is not a String.

Implementation

String text() {
  try {
    return data as String;
  } catch (e) {
    throw LuckyParseException(
      'Expected String, got ${data.runtimeType}',
      cause: e,
    );
  }
}