of static method

PaymentController? of(
  1. BuildContext context, {
  2. bool nullOk = false,
})

Implementation

static PaymentController? of(BuildContext context, {bool nullOk = false}) {
  final PaymentForm? result =
      context.findAncestorWidgetOfExactType<PaymentForm>();
  if (nullOk || result != null) return result!.controller;
  throw FlutterError.fromParts(<DiagnosticsNode>[
    ErrorSummary(
        'PaymentForm.of() called with a context that does not contain an PaymentForm.'),
    ErrorDescription(
        'No PaymentForm ancestor could be found starting from the context that was passed to PaymentForm.of().'),
    context.describeElement('The context used was')
  ]);
}