DART overview, concept, features and installation

Dart Google की client-optimised language है जिसकी double life है: build करते समय instant hot reload के लिए JIT-compiled, ship करते समय native code के लिए AOT-compiled: वजह जो Flutter ने इसे चुना।

10 min read · 10 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

Committee का दूसरा Phone

FestConnect Mobile काम करता है: Android पर। फिर fest secretary अपने iPhone के साथ आती हैं, और आपकी Java + XML app इसके लिए कुछ मतलब नहीं रखती। SAME app को 2 languages में, 2 stores के लिए, दो बार बनाना यही है जिससे small teams मरती हैं।

यही वह ridge है जो subject अब पार करता है: Units 3 से 5 app को Flutter में rebuild करती हैं, दोनों phones के लिए एक codebase। पर Flutter एक language बोलता है, और वह Java नहीं है। मिलिए Dart से: आपके future की 2 units, यह क्यों exist करता है वहाँ से शुरू।

Theory

Dart, Formally

Dart Google की open-source, client-optimised language है (2011): किसी भी screen पर fast user interfaces बनाने के लिए designed।

इसका identity card:

  • object-oriented: सब कुछ एक object है, numbers और functions भी included
  • C-style syntax: braces, semicolons: एक Java reader नज़र पड़ते ही 80% घर जैसा feel करता है
  • statically typed with inference: int seats = 350; declare कीजिए या var को deduce करने दीजिए: दोनों तरह type fixed और checked है
  • null safety: modern Dart may-be-null को type system का हिस्सा बनाता है
  • Flutter की language

Practical

पहला Dart: main, var, और Interpolation

void main() {                       // execution starts here, like Java
  var fest = 'TechnoUtsav';         // var INFERS String, then fixes it
  int seats = 350;
  int booked = 310;

  // String interpolation: $variable inside the string
  print('$fest: ${seats - booked} seats left');
  // Output: TechnoUtsav: 40 seats left
}

Theory

Double Life: JIT और AOT

Dart की defining engineering trick है 2 अलग moments के लिए 2 अलग तरीकों से compile करना:

  • Develop करते हुए: JIT (just-in-time)। Code incrementally compile होता है जैसे यह चलता है, तो एक saved change running app में एक second के अंदर दिखता है: Flutter का celebrated hot reload
  • Ship करते हुए: AOT (ahead-of-time)। Release build पूरी तरह native ARM machine code में compile होती है: party में कोई interpreter नहीं, पूरी phone speed

Java ने आपको javac-then-JVM दिया; Dart कहता है: lab में interpretive agility, store में native muscle। एक तीसरा compiler, dart2js, browsers को target करता है (अगला lesson)।

Theory

Installation: दो Doors

  • Standalone Dart SDK: dart.dev से, pure Dart work के लिए: command-line programs, servers
  • Flutter के साथ Bundled (इस subject के लिए usual route): Flutter SDK install करना (Unit 3) automatically Dart को साथ लाता है: एक download, दोनों tools

दोनों तरह, verification एक terminal में एक command है:

dart --version

और आज के लिए, installation भी optional है: DartPad browser में Dart चलाता है, zero setup: पूरा अगला lesson।

Quiz

यह subject आख़िर Java से Dart पर क्यों switch करता है?

  1. Dart programs Android पर Java से fast चलते हैं
  2. Flutter, Units 3 से 5 का one-codebase-for-Android-and-iOS toolkit, Dart के around built है
  3. Google ने सारे Android development के लिए Java deprecate कर दिया है
  4. Dart आसान है, कोई types declare नहीं करने
Show the answer

Flutter, Units 3 से 5 का one-codebase-for-Android-and-iOS toolkit, Dart के around built है

Switch strategic है, stylistic नहीं: Flutter destination है (एक app, दोनों phones: secretary का iPhone problem), और Flutter की language Dart है, JIT/AOT double life के लिए चुनी गई जो hot reload AND native releases दोनों possible बनाती है। Option A overclaim करता है: दोनों fast हैं; speed motive नहीं है। Option C false है: Java/Kotlin Android development ज़िंदा और अच्छी है: Flutter एक alternative है, replacement नहीं। Option D doubly wrong है: Dart IS typed है: var एक type infer करता है, इसे abandon नहीं करता।

Think first

Java जैसा एक Compiler क्यों नहीं?

Java development और release दोनों के लिए एक pipeline (javac से bytecode से JVM) इस्तेमाल करता है। Dart TWO maintain करता है (JIT और AOT)। App की life का हर moment क्या demand करता है, और एक pipeline दोनों serve करने में क्यों struggle करता है, reason करके tap कीजिए।

Show the answer

Development fast iteration चाहता है: बदलिए, देखिए, बदलिए: JIT सिर्फ़ ज़रूरत की चीज़ compile करता है, live, hot reload enable करते हुए; पर JIT machinery running app के अंदर ship होनी चाहिए और समय के साथ warm up होती है। Release raw speed और small size चाहती है: AOT सब कुछ पहले से native ARM में compile करता है: instant startup, phone पर कोई compiler नहीं: पर हर change पर पूरा rebuild करना development को crawl करा देगा। एक pipeline एक moment optimise करता है; Dart की 2 pipelines हर एक अपना serve करती हैं। Exam line: hot-reload development के लिए JIT, release के लिए native code को AOT।

Watch out

First-Contact Confusions

var "no type" नहीं है: var seats = 350 seats को हमेशा के लिए एक int बनाता है; बाद में 'full' assign करना एक compile error है। असली untyped opt-out dynamic है, sparingly इस्तेमाल किया जाता है।

Dart "Java for iOS" नहीं है: यह अपनी own language है; syntax similarity एक welcome mat है, identity नहीं।

print Interpolation Concatenation से बेहतर है: '$fest: $seats' Dart idiom है; fest + ": " + seats.toString() लिखना आपको एक tourist की तरह mark करता है।

Theory

Dart को Java Eyes से पढ़िए, Accents नोट कीजिए

आपका BCA403 investment लगभग पूरा transfer होता है: main(), braces, semicolons, if/for/while, classes। जैसे आगे बढ़ें एक छोटी accent list रखिए: single quotes strings के लिए idiomatic हैं, $interpolation concatenation replace करता है, var infer करता है, और print() को कोई System.out नहीं चाहिए। अगला lesson आप बिना ZERO installation के Dart लिखते और चलाते हैं: browser में DartPad, plus वह compiler जो Dart को JavaScript में बदलता है।

Summary

Key takeaways

  • Dart: Google की client-optimised, object-oriented language, C-style syntax और null safety के साथ।
  • Statically typed with inference: var एक बार type deduce करता है और इसे fix करता है; dynamic rare opt-out है।
  • Dual compilation: develop करते हुए JIT (hot reload), release के लिए native ARM में AOT।
  • dart2js अतिरिक्त रूप से browsers के लिए Dart को JavaScript में compile करता है।
  • Dart Flutter की language है: Android और iOS के लिए एक codebase: switch की वजह।
  • dart.dev से standalone install कीजिए या Flutter के साथ bundled; dart --version से verify कीजिए।
  • Memory hook: lab में JIT, store में AOT, हर phone पर एक language।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Working with DART

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

DART overview, concept, features and installation · Mobile Application Development - 2 (option B) · Gri-Learn