A Beginners Guide to Dart - The Tooling Ecosystem - Part Nine

in #utopian-io6 years ago

dart-bird.jpg

Repository

https://github.com/dart-lang/sdk

What Will I Learn?

  • You will learn about the Dart Tool Pipeline
  • You will learn about the Pub Tool
  • You will learn how to install external dependencies in Dart
  • You will learn how to use the Observatory in Dart
  • You will learn about the Testing suites that exist for Dart

Requirements

System Requirements:
OS Support for Dart:
  • Windows
  • macOS
  • Linux

Required Knowledge

  • The Dart SDK
  • A Dart supported text editor (Dart Pad can be used)
  • A little time to sit and watch a video and some patience to learn the language

Resources for Dart:

Sources:

Dart Logo (Google): https://www.dartlang.org/

Difficulty

  • Beginner

Description

In this Dart video tutorial, we finish off the beginners guide by looking at the tooling pipeline for the Dart programming language. This includes taking a look at the Pub tool; a tool which helps manage dependencies and allows developers to install and use global executables like Stagehand or Webdev. We also look at the Dart Observatory which is a built in profiling tool that allows you to look at the CPU and memory footprint of your applications and their isolates. And finally we finish by looking at the default test suite and how it can be used for test driven development.

Managing Dependencies and Global Executables with Dart's Pub Tool

The Pub tool is Dart's primary way to managing packages. It is similar to other dependency management tools like JavaScript's NPM, Elixir's Mix and Rust's Cargo. The Pub tool allows developers to define a pubspec.yaml file with metadata inside of it. This metadata is then read by the CLI and used to build the project. The Pub tool also allows developers to install and eternal CLI executables.


pubspec.png

Above is an example of a pubspec.yaml file for a fully functional flutter application. By default, all dart apps must contain an environment key; this key tells the pub tool which virtual machine to use when running the application. In this case, we want to use a version of the Flutter SDK that is greater than 2.0.0-dev.68.0 but less than version 3.0.0. Below this key is a dependencies key which defines what third party dependencies are needed to run this application. Below the dependencies key is a dev_dependencies key which defines dependencies that are needed in development but not needed when the application is published.

Profiling an Application with the Dart Observatory

The Dart Virtual machine also features a profiling tool called the Observatory. This tool allows the developer to peek into a running Dart virtual machine instance and it provides live data and state for your project. You can use the Observatory to determine how the memory is allocated, how the application's code is spending its execution time, which lines of code are being executed, and how the CPU is handling the load. The Observatory is often used to debug memory leaks and memory fragmentation.


observe.png

Above is an image of the Dart Observatory's debugger window. The Graphical user interface (GUI) for the Observatory is served via a web server which runs on the Dart Virtual Machine. You are then able to access the Observatory by pointing a browser at localhost:8181. Notice that the debugger shows the code that is being executed on the left hand side of the screen. On the right hand side of the screen is a cross section of the state at that given moment; with each variable showing its current value. On the bottom is a command prompt that allows the user to manipulate the code in ways that are useful to debug the application. This includes pausing the code, stepping backwards through the state, pushing the code forward line by line and directly modifying the state.

The Source Code for this video may be found here: https://github.com/tensor-programming/dart_for_beginners/tree/tensor-programming-patch-8

Video Tutorial

Curriculum

Projects

Sort:  

Hello @tensor

This is another great video tutorial adding towards the Dart series.

I like the detail instructions you give so that learners can follow along from one concept to the next.

Great to see you contributing again.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thanks @rosatravels. Had some family issues these past few weeks that made it hard to contribute. Going to start going into full on work mode in the coming weeks, I look forward to hearing your feedback.

Thank you for your review, @rosatravels! Keep up the good work!

Hi @tensor!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hi, @tensor!

You just got a 5.88% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.


This post has been voted on by the SteemSTEM curation team and voting trail.

If you appreciate the work we are doing, then consider supporting our witness stem.witness!

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider setting @steemstem as a beneficiary to your post to get a stronger support.

Please consider using the steemstem.io app to get a stronger support.

Hey, @tensor!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.24
TRX 0.21
JST 0.036
BTC 97936.99
ETH 3366.06
USDT 1.00
SBD 3.35