0
Widget getPicker() {
  if (Platform.isAndroid) {
    getDropdownButton();
  } else if (Platform.isIOS) {
    getCupertinoPicker();
  }
}

error: The body might complete normally, causing 'null' to be returned, but the return type, 'Widget', is a potentially non-nullable type. i tried using return

Widget getPicker() {
  if (Platform.isAndroid) {
    return getDropdownButton();
  } else if (Platform.isIOS) {
    return getCupertinoPicker();
  }
}

1 Answers1

1

Try this way:

Widget getPicker() {
  if (Platform.isAndroid) {
    return getDropdownButton();
  } else {
    return getCupertinoPicker();
  }
}
Siddharth Mehra
  • 1,691
  • 1
  • 9
  • 32