Dart Courses Project - A console Dart project

Hello. This repository includes all the exercises in 3 courses what I made in this year. Here, contains all the answers/code from this courses.

I've made some changes in answers to give my style to this project. And I've write codes to Dart version 3 too (the course writes in Dart version 2).

Here a list of courses and exercises:

Exercise 1: Change the hello world application to display your name.

SOLUTION HERE


Exercise 2: Ask the user for their first name, and store their input in a variable. Then ask the user for their last name and store that in a variable. Finally display the full name to the user.

SOLUTION HERE


Exercise 3: Create a list of people, ask the user for an index. Display the person in the list at the index the user supplied.

SOLUTION HERE


Exercise 4: Use a loop to count to 10. Print each number on the screen. At the 5th loop, print out "half way there".

SOLUTION HERE


Exercise 5: Ask the user for a maximum number, use a loop to print each number on the screen from 1 to the number they provided. At the half way point, print out "half way there". Spit these tasks into functions.

SOLUTION HERE


Exercise 6: Ask the user for an age, if the age is less than 18, throw an Exception of "too young". If the age is over 99 throw an Exception of "too old". Catch the Exception and use a catch all. Also split these tasks up into different functions.

SOLUTION HERE


Exercise 1: Import the "path" package and use it to join a directory path to a filename and print out the results.

SOLUTION HERE


Exercise 2: Create an employee class. This class should have two strings, "name" and "position". Set those strings in the constructor. Then make a function that prints out the employee's name and position.

SOLUTION HERE

CLASS CODE OF SOLUTION HERE


Exercise 3: Create a person class that has an age getter but not a setter. This will allow the age to be read from the class but not changed. Set the age in the class constructor.

SOLUTION HERE

CLASS CODE OF SOLUTION HERE


Exercise 4: Make a Bed and Breakfast class (BnB) that inherits a House class and uses a Hotel class as a interface. The hotel class should have a "guests" variable as an integer. The abstract house class should have a rooms variable as a integer and a function "ringDoorbell". The Bnb class will need to implement the house properties.

SOLUTION HERE

CLASSES's CODE OF SOLUTION HERE


Exercise 5: Make the following classes:
  
Employee
Manager – inherit employee
Cashier – inherit employee
Payroll – use generics to allow only descendants of the employee class
  
Both the Cashier and Manager classes should have a “sayHello” function that prints the class name. The payroll class should allow adding to an internal list, and a “print” function that calls the “sayHello” of each item in the internal list.

SOLUTION HERE

CLASSES's CODE OF SOLUTION HERE


Exercise 6: Create a file in the current directory. Write "Hello World" into the file. Read the contents of the file back. Delete the file.

SOLUTION HERE


Exercise 1: Determine the operating system you are on and print the PATH variable from the operating system.

SOLUTION HERE


Exercise 2: Append to a file and read it back asynchronously.

SOLUTION HERE


Exercise 3: Compress some data using GZIP or ZLIB and write it to a file, then decompress it and print it on the screen.

SOLUTION HERE


Exercise 4: Use Salsa20 to encrypt a string, then use SHA-256 to compare the plain text to the encrypted text.

SOLUTION HERE


Exercise 5: Download a web page using HTTP Get and display the length.

SOLUTION HERE


Exercise 6: Use SQlJocky to add rows to a table.

OBS: I'm using other lib for database, because SQLJocky does not have support for Dart 3.

SOLUTION HERE


To run this project, executes first in the root directory of project:

dart pub install

After this, run this command to see the app running:

dart bin/main.dart

That's IT - Let's Code!