has method Null safety

bool has(
  1. String name

Returns a boolean stating whether a Headers object contains a certain header. myHeaders.has(name); Creating an empty Headers object is simple:

var myHeaders = new Headers(); // Currently empty

You could add a header to this using Headers.append, then test for the existence of it using has():

myHeaders.append('Content-Type', 'image/jpeg'); myHeaders.has('Content-Type'); // Returns true myHeaders.has('Accept-Encoding'); // Returns false


external bool has(String name);