initShortCuts function Null safety

void initShortCuts(
  1. Widget homePage,
  2. {Set<Set<LogicalKeyboardKey>>? keysToPress,
  3. Set<dynamic Function(BuildContext context)>? onKeysPressed,
  4. Set<String>? helpLabel,
  5. Widget? helpGlobal,
  6. String? helpTitle,
  7. IconData? helpIcon}
)

Implementation

void initShortCuts(
  Widget homePage, {
  Set<Set<LogicalKeyboardKey>>? keysToPress,
  Set<Function(BuildContext context)>? onKeysPressed,
  Set<String>? helpLabel,
  Widget? helpGlobal,
  String? helpTitle,
  IconData? helpIcon,
}) async {
  if (keysToPress != null &&
      onKeysPressed != null &&
      helpLabel != null &&
      keysToPress.length == onKeysPressed.length &&
      onKeysPressed.length == helpLabel.length) {
    _newGlobal = [];
    for (var i = 0; i < keysToPress.length; i++) {
      _newGlobal.add(Tuple3(keysToPress.elementAt(i), onKeysPressed.elementAt(i), helpLabel.elementAt(i)));
    }
  }
  _homeWidget = homePage;
  _customGlobal = helpGlobal!;
  _customTitle = helpTitle;
  _customIcon = helpIcon;
}