data method

String data(
  1. String key, {
  2. String def = '',
})

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 = ''}) {
  var map = getAllData();
  ModelLess modelLess = ModelLess.fromMap(map);

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