Giter Site home page Giter Site logo

dart-crash-course's Introduction

dart-crash-course

Dart Crash Course

1) Dart: Variables and Data Types

    # How to run a code
    # In terminal type dart bin/file_name
    # Or
    # Use fswatch (recommended)
    # To install fswatch, write this command 'brew install fswatch' in the project directory
    # eg: fswatch -o bin/ | xargs -n1 -I{} sh -c 'clear; dart bin/example.dart'
    # fswatch: watches chanhges that are happening in bin/ folder
    # then execute clear and then dart bin/example1.dart
    # so whenever the file is changed it will rerun the command dart bin/example.dart and will      # display new chnages

    # variables & data types
    # file: example1.dart
    # const: special keyword: can not change the value
    # syntax: const variable_name = value
             #   eg const name = 'Foo';
             #   print(name)  // prints => Foo
             #   name = 'Hello' // Error: constant variables can't be assigned a value

    # file example2.dart
    # final: special keyword
    # syntax: final variable_name = value
             #eg final name = 'Foo';
             #   print(name)  // prints => Foo
             #   name = 'Hello'
    # const vs final
    # const value can not be changed and can not be re assign
    # final value can be set only once but internal value can be changed
    # Note: two type of immutablity
        1) value can be re assigned after creation
        2) value can not be changed

    # Two types of  Mutation
    # 1) reassign value
    # 2) mutate/change the value

    # value of variable of same  data type can be assiged to value of same data type
    # LHS same datatype = RHS same datatype [correct]
    # LHS datatype =  RHS different datatype [error]
    # eg var name = '';
    #    name = 'Foo' // correct as the LHS is string and RHS is string
    #    name = 12    // error as the LHS is string but RHS is int

    # const variable  value can be assigned to final variables but final variable value cannot be    # assigned to const variable

    # late variale
    #  Its intialised when they are first used
    #  refer 'example8.dart' for code example

    # Type Promotion
    # tell dart we have value of a less precision that need to be assigned with value of more        # precision
    # eg int and double

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.