- 01Setting up (what you'll need)
- 02Your first output (print)
- 03Variables and types (var and annotations)
- 04Null safety (? and !)
- 05Branching (the if statement)
- 06Repeating (the for loop)
- 07Writing your own function
- 08Repeating (the while loop)
- 09Working with lists (List)
- 10Working with maps (Map)
- 11Classes (object orientation)
- 12Constructors
- 13Inheritance
- 14Named arguments
- 15Asynchronous work (Future, async, await)
- 16Working with strings
- 17The switch statement
- 18The ternary operator
- 19Extension methods
- 20[Project] Build a small inventory system
Working with strings
This lesson covers basic string handling in Dart.
Strings come with handy properties and methods such as length, toUpperCase() for upper-casing, and substring() for taking a piece out.
The sample code checks the character count with message.length and takes the first five characters with message.substring(0, 5).
A common early stumble is that the "end" in substring(start, end) is not included. substring(0, 5) takes the five characters at positions 0 through 4.
In professional work, string handling — validating user input, shaping the text shown in the interface — is essential in practically every app.
๐งช This site can't compile or run Dart directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
