Remove last character:
if (str != null && str.length > 0) {
str = str.substring(0, str.length - 1);
}
Remove last 5 characters:
if (str != null && str.length >= 5) {
str = str.substring(0, str.length - 5);
}
Related Contents:
- How to create number input field in Flutter?
- How do I format a date with Dart?
- Flutter- wrapping text [duplicate]
- How does the const constructor actually work?
- What’s the difference between async and async* in Dart?
- How do I add Methods or Values to Enums in Dart?
- List firstWhere Bad state: No element
- How can I hide letter counter from bottom of TextField in Flutter
- How to solve Flutter CERTIFICATE_VERIFY_FAILED error while performing a POST request?
- Flutter (Dart) How to add copy to clipboard on tap to a app?
- What is the relation between stateful and stateless widgets in Flutter?
- flutter – correct way to create a box that starts at minHeight, grows to maxHeight
- Check value in array exists Flutter dart
- What is the difference between “show” and “as” in an import statement?
- Adding orElse function to firstWhere method
- Flutter Navigator.pop(context) returning a black screen
- How to run code after showDialog is dismissed in Flutter?
- How to check which the current Route is?
- Horizontally scrollable cards with Snap effect in flutter
- Full width DropdownButton with adjust dropdown arrow icon in Flutter
- Make BoxDecoration image faded/transparent
- Rounded corner Card Widget with right border in flutter
- How to close Scaffold’s drawer after an item tap?
- Flutter: Update Widgets On Resume?
- Flutter – How to hide/remove title of BottomNavigationBarItem
- How do I stack widgets overlapping each other in flutter
- Constructor Optional Params
- How do I pass non-string data to a named route in Flutter?
- Why Flutter Container does not respects its width and height constraints when it is inside other Container
- Flutter – FloatingActionButton in the center
- How to get the last n-characters in a string in Dart?
- Flutter – How does it work behind the scenes?
- How to write a `ByteData` instance to a File in Dart?
- Is it possible to initialize a List on one line in Dart? (it’s called a collection initializer in c#)
- Flutter: How to resolve Error importing package:http/http.dart
- Flutter setState to another class?
- How do I read console input / stdin in Dart?
- Asynchronous iterable mapping in Dart
- AlertDialog without context in Flutter
- How to Pick files and Images for upload with flutter web
- Should I prefer to iterate over Map.entries or Map.values?
- Difference between .then() and .whenCompleted() methods when working with Futures?
- Difference in NetworkImage and Image.network?
- Vertically center text in text field in Flutter
- How to change from Stateless Widget to Stateful Widget?
- How do I compare two objects to see if they are the same instance, in Dart?
- How to modify plugins Dart code Flutter?
- How to set state from another widget?
- Is there a constant for max/min int/double value in dart?
- Why does setState take a closure?