submit method

void submit({
  1. bool explicit = false,
})

Invokes the onSubmit or handleNewLines depending on whether the platform is Web iOS or not.

If explicit, then the handleNewLines part will be skipped.

Implementation

void submit({bool explicit = false}) {
  // If this action wasn't explicit, then do the [handleNewLines].
  if (!explicit && PlatformUtils.isIOS && PlatformUtils.isWeb) {
    // This is required due to a bug with "enter" keyboard button in the
    // browsers for some reason submits the field instead of appending a new
    // line.
    handleNewLines(
      KeyDownEvent(
        physicalKey: PhysicalKeyboardKey.enter,
        logicalKey: LogicalKeyboardKey.enter,
        timeStamp: Duration.zero,
      ),
      hasModifier: true,
      field,
    );

    return;
  }

  field.unsubmit();
  onSubmit?.call();
}