copy method

  1. @override
bool copy(
  1. String text
)

Consumes the given text with the copy right.

Returns whether the user is allowed to copy the given text.

Implementation

@override
bool copy(String text) {
  int? charactersLeft = charactersToCopyLeft;
  if (charactersLeft == null) {
    return true;
  }
  if (text.length > charactersLeft) {
    return false;
  }

  try {
    charactersLeft = max(0, charactersLeft - text.length);
    _licenses.setCopiesLeft(charactersLeft, license.id);
  } on Error catch (error) {
    Fimber.e("ERROR in copy", ex: error);
  }
  return true;
}