debugBuildAlertPayload function
Map<String, Object?>
debugBuildAlertPayload({
- required List<
CNAlertAction< actions,Object?> > - String? title,
- String? message,
- List<
CNAlertTextField> textFields = const <CNAlertTextField>[],
Builds the method channel payload for CNAlert.show.
Exposed for tests: the payload is the contract shared with
CNAlertManager.swift, so it is asserted directly rather than through a
platform round trip.
Implementation
@visibleForTesting
Map<String, Object?> debugBuildAlertPayload({
required List<CNAlertAction<Object?>> actions,
String? title,
String? message,
List<CNAlertTextField> textFields = const <CNAlertTextField>[],
}) {
return <String, Object?>{
'title': title,
'message': message,
'actions': [
for (final action in actions)
<String, Object?>{
'label': action.label,
'style': _styleName(action),
'enabled': action.enabled,
'preferred': action.isDefault,
},
],
'textFields': [
for (final field in textFields)
<String, Object?>{
'placeholder': field.placeholder,
'initialText': field.initialText,
'obscure': field.obscureText,
},
],
};
}