Write Code Once. Run It Everywhere.
Dart is a clear, fast coding language made by Google. It lets you build apps for phones, computers, and the web using just one set of code.
> Hello, Developer.
> Loading Dart Engine...
> Ready to build fast apps.
Why did Google make Dart?
The Old Way (Slow)
In the past, to make an app for everyone, you had to hire three different teams:
- Team 1: Wrote Apple code.
- Team 2: Wrote Android code.
- Team 3: Wrote Website code.
Result: High cost, slow work.
The Dart Way (Fast)
Google made Dart so you only need one team. You write the code one time.
ONE DART CODE
Result: Low cost, fast work.
Where can Dart run?
When you write instructions in Dart, the language knows how to translate those instructions for different machines. Here is where it works:
Mobile Phones
Makes apps for iPhones and Android phones. They look and feel like they belong on the phone.
Web Browsers
Turns your code into standard web language. Your app can run directly inside Chrome or Safari.
Computers
Creates full programs for Windows, Mac, and Linux computers from the exact same code.
Meet Flutter: Dart's Best Friend
You almost never hear about Dart without hearing about Flutter. They work as a team.
-
1
Dart is the Brain. It handles the math, the rules, and getting data from the internet.
-
2
Flutter is the Face. It handles the colors, the buttons, and making things look beautiful on the screen.
The Speed Secret
Coding usually forces you to choose: Do you want it to be fast for the builder to write, or fast for the user to use? Dart gives you both by using two different engines.
Fast for You
JIT (Just-In-Time)
When you are writing code, Dart translates it instantly. If you change a color from red to blue, the screen updates in half a second. You do not have to wait. This is called "Hot Reload."
Fast for the User
AOT (Ahead-Of-Time)
When the app is ready for the app store, Dart locks everything in. It turns your code into native machine language. The user gets an app that opens fast and runs smooth, with no lag.
What does Dart look like?
Dart is designed to look familiar. If you have ever seen JavaScript, Java, or C++, Dart will make sense to you right away. It is very clean.
void main() {
// We create a variable (a box holding a word)
String appName = 'My Great App';
// We create a number
int version = 1;
// We ask Dart to print a message to the screen
print('Welcome to $appName, version $version!');
}
The "No Empty Box" Rule (Sound Null Safety)
Many apps crash because the code expects to find data in a box, but the box is empty (programmers call this "Null").
Dart has a feature built in that checks your boxes before the app even runs. If a box might be empty, Dart forces you to write a plan for it. This means your apps crash much less often.
The Tool Store: Pub.dev
You do not have to write everything from scratch. Dart has a giant library of free code called pub.dev.
Need your app to take pictures? Need it to open maps? Someone has already written that code. You just add the package to your app and use it. It is like an app store, but for code tools.
40,000+
Free Code Packages
Trusted by Big Teams
Everything is a "Thing" (Object)
In Dart, every piece of data is treated like a real-world object. Think of a Car.
- A Car has details (Color: Red, Doors: 4).
- A Car can do actions (Drive, Stop, Honk).
Dart treats numbers, words, and even buttons on the screen this same way. They all have details and actions. This makes your code very organized.
Waiting Without Freezing (Async)
Sometimes your app needs to download a big picture from the internet. If the app stops and waits, the screen freezes. The user gets mad. Dart fixes this instantly.
Order Coffee
The app asks the internet for a picture. (Like ordering a coffee at a cafe).
Step Aside
Instead of freezing, Dart gives you a receipt (called a "Future") and tells the app to keep working on other things.
Coffee is Ready
When the picture finishes downloading, Dart taps the app on the shoulder and shows the picture. No freezing!
Smart Guesses (Type Inference)
Older Languages
You have to explain everything perfectly.
NumberBox myAge = 30;
Dart (Smart)
Dart looks at what you type and guesses the box type for you. Less typing!
var myAge = 30; // Dart knows it is a number
Heavy Lifting (Isolates)
Most apps only have one "worker". If that worker has to do a giant math problem, the app stops responding to your touches.
Dart Hires More Workers
Dart uses things called Isolates. An Isolate is like a totally separate room with its own worker. You send the heavy math problem to the Isolate room. The main worker stays out front, keeping the app smooth and happy.
(Front Desk)
(Back Room)
Organizing Data (Collections)
When you have a lot of information, you need a neat way to store it. Dart gives you two main tools that are very easy to use.
Lists (The Line)
A simple list of items in order. Just like a grocery list.
Maps (The Dictionary)
Data that goes together in pairs. A word, and its meaning.
The X-Ray Glasses (DevTools)
Sometimes apps run slow or look weird, and it is hard to know why.
Dart comes with a tool called DevTools. It is a set of tools that runs in your web browser. It lets you:
- See exactly how much memory your app is using.
- Find the exact line of code making the app slow.
- Click a button on your phone and see its code on your screen.
Two Ways to Refresh
When you are building an app, you change the code a lot. Dart gives you two super-fast ways to see your changes.
Hot Reload
What it is: Instantly updates the screen. Like changing the paint color on a house.
The best part: If you are filling out a long form in your app and you Hot Reload, your typed words stay there! The app does not lose its place.
Hot Restart
What it is: Resets the whole app back to the starting screen. Takes about 1 to 2 seconds.
The best part: It is like turning a video game off and on again, but without waiting for the slow loading screens.
Built by Everyone (Open Source)
You Are Never Alone
Learning a new skill can be scary. But Dart has one of the nicest groups of people on the internet ready to help you.
Discord Chats
Join free chat rooms where experts answer questions live, 24 hours a day.
Video Guides
YouTube is packed with free, step-by-step videos teaching you how to build real apps.
Stack Overflow
A giant website where almost every question you have has already been answered.
Why Companies Pay For This
Companies love saving money. If a boss can hire one person who knows Dart, that person can build the iPhone app, the Android app, and the website.
Because you save the company so much time and money, Dart and Flutter developers are in very high demand and can make a great living from anywhere in the world.
High Demand
Skill: Dart & Flutter
3 Steps to Start Today
Test it Online
You do not even need to install anything. Go to dartpad.dev in your web browser and you can write and run Dart code instantly.
Get the Tool
Download the Flutter SDK (Software Development Kit). It includes Dart and everything you need to build full apps.
Write "Hello World"
Follow a basic tutorial to print text to the screen. Once you understand the basics, you are ready to build!