0
0
Fluttermobile~10 mins

Dart programming language overview in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a variable that cannot be changed.

Flutter
final [1] = 10;
Drag options to blanks, or click blank then click option'
Avar
Bconst
Ccount
Dlet
Attempts:
3 left
💡 Hint
Common Mistakes
Using a keyword like 'var' as a variable name.
Leaving the variable name blank.
2fill in blank
medium

Complete the code to define a function that returns a greeting string.

Flutter
String greet() {
  return [1];
}
Drag options to blanks, or click blank then click option'
A'Hello World'
BHello World
C"Hello World"
Dgreeting
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string.
Using a variable name that is not defined.
3fill in blank
hard

Fix the error in the code to create a list of integers.

Flutter
List<int> numbers = [1];
Drag options to blanks, or click blank then click option'
A<1, 2, 3, 4>
B(1, 2, 3, 4)
C{1, 2, 3, 4}
D[1, 2, 3, 4]
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of square brackets.
Using curly braces which create a set.
4fill in blank
hard

Fill both blanks to create a map with string keys and integer values.

Flutter
Map<String, int> ages = [1];
ages['Alice'] = [2];
Drag options to blanks, or click blank then click option'
A{'Bob': 30}
B25
C40
D['Bob', 30]
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list instead of a map.
Assigning a string instead of an integer value.
5fill in blank
hard

Fill all three blanks to create a conditional that prints a message if a number is positive.

Flutter
int number = 5;
if (number [1] 0) {
  print([2]);
} else {
  print([3]);
}
Drag options to blanks, or click blank then click option'
A>
B'Positive'
C'Not positive'
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong comparison operator.
Forgetting quotes around the strings in print.