data method

String data(
  1. String key, {
  2. String def = '',
  3. bool trim = true,
})

Retrieves the value associated with key from the request data.

The value is sanitized to prevent script injection. An optional def (default value) can be provided if the key is not found.

Implementation

String data(String key, {String def = '', bool trim = true}) {
  ModelLess modelLess = ModelLess.fromMap(getAll());

  String res = modelLess.get<String>(key, def: def);
  return trim ? res.removeScripts().trim() : res.removeScripts();
}