getConstructorArg static method

String getConstructorArg({
  1. required String name,
  2. bool isRequired = false,
  3. String defaultValue = '',
})

Implementation

static String getConstructorArg({
  required String name,
  bool isRequired = false,
  String defaultValue = '',
}) {
  String res = '';
  if (isRequired) {
    res += 'required ';
  }
  res += 'this.$name ${defaultValue == '' ? '' : '= $defaultValue'}';
  return res;
}