Dart RSS

assertions, Dart, Google Flutter -

Why Have Error & Exception Handling? Most software systems are complicated and written by a team of people.   Complexity arises from multiple sources: The business domain. The act of writing software. From multiple people working together, each one having different viewpoints. etc   The complexity can result in misunderstandings, errors & exceptions.   This is not the end of the world if the code has good error handling.   If you don't handle your errors & exceptions, your software may act unpredictably, and users may suffer a catastrophic error without knowing it or being able to detect when it...

Read more

Dart, Google Flutter, maps -

Introduction An object that maps keys to values. Both keys and values in a map may be of any type. A Map is a dynamic collection. In other words, Maps can grow and shrink at runtime. Example void main() {   Map<String, String> stateNamesByStateCode =   {"AL": "Alamaba",    "AK": "Alaska",    "AR": "Arkansas",    "AZ": "Arizona"   };     stateNamesByStateCode["GA"] = "Georgia";     for (String key in stateNamesByStateCode.keys){             print(stateNamesByStateCode[key]);      }     print("\nGet just one: ${stateNamesByStateCode["AK"]}"); } Example Output Alamaba Alaska Arkansas Arizona Georgia   Just one: Alaska

Read more

Dart, Google, Google Flutter -

Introduction Dart Combines Lists and Arrays In Dart, a List is an ordered Collection (sometimes called a sequence). Unlike other languages, an Array and a List have been combined together and are the same thing. A list is a number of items (objects) in an unordered structure. Additional items can be added to the list. Items can be updated or removed from the list if required. Lists may contain duplicate elements. Iterators You can use an iterator to go through the list items one by one programatically. As a developer, you will use iterators all the time. Example Note how the List in the example below (containing items...

Read more

Dart, Google, Google Flutter -

The mainstream Dart web development route is now writing code with Dart but compiling and running as JavaScript using webdev, which works with the build_runner utility.   Installing You will have to install the webdev package using the pub dependency manager: pub global activate webdev   This installs webdev and makes sure it is available on the command line.   Commands webdev serveRuns a development server that continuously builds a web app. webdev buildBuilds a deployable version of a web app. build_runner testRuns tests.   JavaScript Compilers When you invoke webdev, it invokes the dart2js and dartdevc JavaScript compilers in combination...

Read more

Dart, Google, Google Flutter -

Name Description dart Enables you to execute a .dart file within the Dart Virtual Machine. dart2js Compiles dart source code to JavaScript. dartanalyser Analyses dart source code. This is used by many of the code editors to provide error and warning highlighting. dartdevc Compiles dart source code to JavaScript. Similar to dart2js except that it supports incremental compilation, which lends itself to developers. dartdoc Generates Dart documentation from source code.  As the seminal book ‘Domain-Driven Design’ by Eric Evans states: ‘the code is the model and the model is the code’. dartfmt Formats Dart source code. This is used by...

Read more