GithubHelp home page GithubHelp logo

dart_progs's Introduction

dart_progs

This repository contains dart programs from textbook "Dart: Up and Running"

Dart is expected to help in 2 ways:

  1. Better Performance : A more structured language is easier to optimize, and a fresh VM enables improvements such as faster startup.
  2. Better Productivity : Support for libraries and packages helps you work with other developers and easily reuse code from other projects.

What's cool about Dart?

  • Dart is easy to learn. It’s an object-oriented language with classes, single inheritance, lexical scope, top-level functions, and a familiar syntax.
  • Dart compiles to JavaScript. Dart has been designed from the start to compile to JavaScript, so that Dart apps can run across the entire modern web.
  • Dart runs in the client and on the server. With built-in library support for files, directories, sockets, and even web servers, you can use Dart for full end-to-end apps.
  • Dart supports type without requiring them. You can omit types when you want to move very quickly, aren’t sure what structure to take, or simply want to express something you can’t with the type system.
  • Dart scales from small scripts to large, complex apps.
  • Dart has a wide array of built-in libraries.
  • Dart supports safe, simple concurrency with isolates. Dart's isolates, inspired by Erlang, provide an easier to understand model for running isolates, but concurrent, portions of your code. Spawning new isolates is cheal and fast, and no state is shared.
  • Dart supports code sharing. With Dart package manager (pub) and language features such as libraries, you can easily discover, install, and integrate code from the web and enterprise.

NOTE: Download the Dart Editor ZIP file for your platform from http://www.dartlang.org/downloads.html

A Tour of the Dart Language

main() : The special, required, top-level function where the app execution starts.

Important Concepts

  • Everything you can place in a vaiable is an object, and every object is an instance of a class.
  • Specifying static types (such as num, String and so on) clarifies your intent and enable static checking by tool, but its optional.
  • Dart parses all your code before running it.
  • Dart supports top-level functions (such as main()), as well as functions tied to a class or object (static and instance methods, respectively).
  • Similarly, Dart supports top-level variables, as well as variables tied to a class or object (static and instance variables). Instance variables are sometimes k/n as field or properties.
  • Dart doesn;t have keywords, public, protected, and private. If an identifier starts with underscore (_), it's private to its library.
  • Dart tools report 2 kinds of errors :
    • Warnings : Just hints, don't prevent your program from execution.
    • Errors : Can either be compile-time or run-time.
      • Compile-time error: prevents the code from executing at all.
      • Run-time errors : results in an exception being raised as the code executes.
  • Dart has two runtime modes :
    • Production Mode : Faster
    • Checked Mode : Helpful at development.

TIP : Lazy initialization of final variables helps app start up faster.

Built-in Types

Dart has special support for the following types:

  • numbers (include int and double)
  • string
  • booleans
  • lists (also known as arrays)
  • maps

Dart support for maps is provided by:

  • Map Literals : Initialize with normal key-value structure. For ex. var map = {'first': 'Saksham', 'last': 'Gupta'};
  • Map Type : Initialize variable with Map constructor. For ex: var map = Map();.

Note: In Map literals, Key MUST be String. While when a variable is initialized with Map constructor, Key can be ANY object.

dart_progs's People

Contributors

saksham-gt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.