registerCustomDialogBuilder method

  1. @Deprecated('Prefer to use the registerCustomDialogBuilders() method. This method will be removed on the next major release. 0.7.0')
void registerCustomDialogBuilder({
  1. required dynamic variant,
  2. required Widget builder(
    1. BuildContext,
    2. DialogRequest,
    3. dynamic (
      1. DialogResponse
      )
    ),
})

Registers a custom dialog builder. The builder function has been updated to include the function to call when you want to close the dialog. This improves readability and ease of use. When you want to close a dialog and return the result all you do is call the completer function passed in. i.e

registerCustomDialogBuilder(variant: MyDialog.Large, builder: (context, request, completer) => Button(onPressed: () => completer(DialogResponse)))

The normal completeDialog function will also still work when called on the service

Implementation

@Deprecated(
  'Prefer to use the registerCustomDialogBuilders() method. This method will be removed on the next major release. 0.7.0',
)
void registerCustomDialogBuilder({
  required dynamic variant,
  required Widget Function(
          BuildContext, DialogRequest, Function(DialogResponse))
      builder,
}) {
  _customDialogBuilders[variant] = builder;
}