Question for Practice 7

Question For Practice 7

  1. What is the purpose of the ? operator in Dart null safety?
  2. Create a late variable named address, assign a US value to it and print it.
  3. How do you declare a nullable type in Dart null safety?
  4. Write a program in a dart to create an age variable and assign a null value to it using ?.
  5. Write a function that accepts a nullable int parameter and returns 0 if the value is null using null coalescing operator ??.
  6. Write a function named generateRandom() in dart that randomly returns 100 or null. Also, assign a return value of the function to a variable named status that can’t be null. Give status a default value of 0, if generateRandom() function returns null.