How to create a button in DART web application

In this article, I am going to explain how to create a button, and how fire a event on created button.
  • 2423

Creating a button in a DART application

In a DART application you can create your own controls like button and whatever you want. for creating a simple web application using a button is given below

Syntax of creating a button

var varname=new Element.tag("varname"); i.e var button = new Element.tag("button");

Example of dart application



void main() {

var button = new Element.tag("button");

button.text = "Click me"; {

List buttonList = document.queryAll("button");

window.alert("There is ${buttonList.length} button");



You can simply run that program by manage and launch application in run option.

Output is ,when you run the program:


Output after click the button:


Ask Your Question 
Got a programming related question? You may want to post your question here
© 2018 DotNetHeaven. All rights reserved.