Dart: How to programmatically add title to 'pop-up' window?


I’ve managed to display a programmatically created ‘pop up’ page with some buttons when a button on my main page is clicked/tapped but don’t know how to display a title. How do I do this and are there any other items I should set in HEAD? I’m a novice here.

btnToolsClicked(Event e) { 

  var content = 'Choose an Action <b>(Work In Progress)</b>'
    '<div id="menu-btns" class="radio-btns">'
      '<input id="B1" type="radio" name="radio-btn">'
        '<label id="lblB1" class="radiobutton-label" for="B1">&nbspExtract Thermal Data.</label><br>'
      '<input id="B2" type="radio" name="radio-btn" >'
        '<label id="lblB2" class="radiobutton-label" for="B2">&nbspCopy Data to USB drive.</label><br>'
      '<input id="BClose" type="radio" name="radio-btn" >'
        '<label id="lblClose" class="radiobutton-label" for="&nbspBClose">Close</label>'

  JsObject w =

  JsObject doc = w['document'];
  doc['head']['innerHtML'] = '<title>Tools Menu</title>'; // FAILS
  doc['body']['innerHTML'] = content;


Haven’t tested it but I would expect this to work:

  JsObject doc = w['document'];
  doc['title'] = 'Tools Menu';

Answered By – Fox32

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *