createFormItem method

Future<FormItem> createFormItem(
  1. int formId,
  2. String type,
  3. int position,
  4. String label, {
  5. String placeholder = '',
  6. String helpText = '',
  7. bool isRequired = false,
  8. bool isFromAddress = false,
  9. bool isSubject = false,
  10. Iterable<String> options = const <String>[],
  11. Iterable<String> spamFilter = const <String>[],
})

Creates a new form item

Implementation

Future<FormItem> createFormItem(
  int formId,
  String type,
  int position,
  String label, {
  String placeholder = '',
  String helpText = '',
  bool isRequired = false,
  bool isFromAddress = false,
  bool isSubject = false,
  Iterable<String> options = const <String>[],
  Iterable<String> spamFilter = const <String>[],
}) async {
  final response = await _post('/api/form/$formId/item', data: {
    'type': type,
    'label': label,
    'placeholder': placeholder,
    'helpText': helpText,
    'isRequired': isRequired,
    'isFromAddress': isFromAddress,
    'isSubject': isSubject,
    'options': options,
    'spamFilter': spamFilter,
    'position': position,
  });

  return FormItem.fromJson(response.data);
}