delete method

Future<void> delete({
  1. required String newText,
  2. Duration delayDuration = const Duration(milliseconds: 100),
})

Implementation

Future<void> delete({
  required String newText,
  Duration delayDuration = const Duration(milliseconds: 100),
}) async {
  final List<String> characters =
      newText.characters.toList().reversed.toList();
  for (var i = 0; i < characters.length; i++) {
    await Future.delayed(delayDuration);
    text = text.substring(0, text.length - 1);
  }
  return;
}