Complete the code to define a function that returns the sum of two numbers using arrow syntax.
int add(int a, int b) => [1];The arrow syntax allows a concise function that returns the expression after the arrow. Here, a + b is returned.
Complete the code to define a function that returns true if a number is even using arrow syntax.
bool isEven(int number) => number [1] 2 == 0;
The modulo operator % returns the remainder. If number % 2 == 0, the number is even.
Fix the error in the arrow function that should return the length of a string.
int getLength(String text) => [1];In Dart, the length of a string is accessed as a property text.length, not as a method.
Fill the blank to define an arrow function that returns the square of a number.
int square(int n) => n [1] n;To square a number, multiply it by itself: n * n.
Fill all three blanks to create a function that returns a greeting message with a name.
String greet(String name) => "Hello" [1] ", " [2] name [3] "!";
String concatenation in Dart uses the + operator. The greeting combines "Hello, ", the name, and "!".