How do you fix it by changing only one keyword?
final discountPercentage = 0; discountPercentage = 20; final item = ""Google Chromecast""; final String offer = ""Sale - Up to $discountPercentage% discount on $item! Hurry up!""; print(offer);
Change the final discountPercentage = 0 to var discountPercentage = 0
final can’t be reassigned to another value
What is the output of the following Dart code snippet?
void main() {
final val1 = "25";
final val2 = "50";
print(val1 + val2);
}2550
Which code snippet correctly calculates and embeds the sum of baseSalary and bonusAmount within a string?
print("Total : ${baseSalary + bonusAmount}");
What is the result of attempting to compile and run this code?
void main() {
final item = "Google Chromecast";
item = "Google Nest Hub";
print(item);
}The program fails to compile due to error
The final keyword indicates that the variable value cannot be changed after initialization
Create named parameter of v1 and v2 inside method add()
int add({int v1, int v2}){
return v1 + v2;
}According to Dart’s rules, what is the default behavior of positional parameters in a function?
They are required, typed in order and must be provided when the function is called
What is the best practices of Dart naming convention?
lowerCamelCase
inputWeight,calCalories
A function is needed to compare screen time: bool didSpendMoreTime(int timeToday, int timeYesterday). What should the body of this function be to return true only if more time was spent today?
return TimeToday > timeYesterday;
What is
1. Parameters
2. Arguments
Which function is the starting entry point for Dart & Flutter?
void main(){}
How to call functionvoid sendNotification({String message, String recipient})
sendNotification(message: "Hello", recipient: "user@gmail.com")
What is the key difference between positional and named arguments regarding their default optionality?
Positional arguments are required by default, while named arguments are optional by default
You have two string variables: final adults = "20"; and final kids = "30";. How would you correctly calculate their sum to get the integer 50?
final total=int.parse(adult) + int.parse(kids)