Skip to content

Commit 35929f4

Browse files
committed
Add dart tutorials source code
1 parent b0f3724 commit 35929f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1354
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,20 @@ All source code from <a href="https://www.youtube.com/playlist?list=PLtUuja72DaL
2424
<p align="center"><a href="https://github.com/Frezyx/flutter_tutorials/tree/main/crypto_coins_list">Source code</a></p>
2525

2626

27+
## 2) Dart for beginners course (ru)
28+
Язык программирования Dart - темная лошадка от Google.
29+
30+
Если серьезно Dart - это язык, на котором можно писать что угодно, но в основном его используют для написания Flutter-приложений. Приложения на фреймворке Flutter имеют одну замечательную особенность - настоящая мультиплатформенность.
31+
32+
Это означает что написав код один раз - вы сможете запустить приложение на любой платформе и операционной системе (iOS, Android, Windows, Web...)
33+
34+
Даже если ты впервые в жизни взял клавиатуру в руки - смело включай курс и начинай изучать один из самых интересных и свежих языков современности
35+
36+
<a href="https://www.youtube.com/watch?v=X4NJJF48o6c&list=PLtUuja72DaLLAo63Zsn1UsLONDafJKWrl&ab_channel=%D0%A1%D1%82%D0%B0%D1%81%D0%98%D0%BB%D1%8C%D0%B8%D0%BD"><img src="https://img.youtube.com/vi/dFNGGoQImUk/maxresdefault.jpg" alt="YouTube"></a>
37+
38+
<p align="center">
39+
<a href="https://www.youtube.com/watch?v=X4NJJF48o6c&list=PLtUuja72DaLLAo63Zsn1UsLONDafJKWrl&ab_channel=%D0%A1%D1%82%D0%B0%D1%81%D0%98%D0%BB%D1%8C%D0%B8%D0%BD"><img src="https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="YouTube"></a>
40+
<a href="https://t.me/frezycode"><img src="https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white" alt="Telegram"></a>
41+
<a href="https://github.com/Frezyx/flutter_tutorials/tree/main/dart_tutorials"><img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white" alt="GitHub"></a>
42+
</p>
43+
<p align="center"><a href="https://github.com/Frezyx/flutter_tutorials/tree/main/dart_tutorials">Source code</a></p>

dart_tutorials/exchange/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://dart.dev/guides/libraries/private-files
2+
# Created by `dart pub`
3+
.dart_tool/

dart_tutorials/exchange/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0
2+
3+
- Initial version.

dart_tutorials/exchange/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
A sample command-line application with an entrypoint in `bin/`, library code
2+
in `lib/`, and example unit test in `test/`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file configures the static analysis results for your project (errors,
2+
# warnings, and lints).
3+
#
4+
# This enables the 'recommended' set of lints from `package:lints`.
5+
# This set helps identify many issues that may lead to problems when running
6+
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
7+
# style and format.
8+
#
9+
# If you want a smaller set of lints you can change this to specify
10+
# 'package:lints/core.yaml'. These are just the most critical lints
11+
# (the recommended set includes the core lints).
12+
# The core lints are also what is used by pub.dev for scoring packages.
13+
14+
include: package:lints/recommended.yaml
15+
16+
# Uncomment the following section to specify additional rules.
17+
18+
# linter:
19+
# rules:
20+
# - camel_case_types
21+
22+
# analyzer:
23+
# exclude:
24+
# - path/to/excluded/files/**
25+
26+
# For more information about the core and recommended set of lints, see
27+
# https://dart.dev/go/core-lints
28+
29+
# For additional information about configuring this file, see
30+
# https://dart.dev/guides/language/analysis-options
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'dart:convert';
2+
3+
import 'package:http/http.dart' as http;
4+
5+
Future<void> main(List<String> arguments) async {
6+
if (arguments.length != 3) {
7+
print('Неверный формат вызова');
8+
print('Формат: exchange EUR GBP 1000');
9+
return;
10+
}
11+
final fromCurrency = arguments[0];
12+
final toCurrency = arguments[1];
13+
final strAmount = arguments[2];
14+
if (double.tryParse(strAmount) == null) {
15+
print('Последним аргументом должна быть сумма');
16+
return;
17+
}
18+
final amount = double.parse(strAmount);
19+
20+
print('Начал подсчет: $fromCurrency -> $toCurrency сумма: $amount');
21+
22+
final uri = Uri(
23+
scheme: 'https',
24+
host: 'api.exchangerate.host',
25+
path: 'convert',
26+
queryParameters: {
27+
'from': fromCurrency,
28+
'to': toCurrency,
29+
'amount': amount.toString(),
30+
'access_key': 'f80b67a9cebb4b434c72dcafa8520235',
31+
},
32+
);
33+
34+
final response = await http.get(uri);
35+
final stringBody = response.body;
36+
final data = JsonDecoder().convert(stringBody) as Map<String, dynamic>;
37+
print(data['result']);
38+
}

0 commit comments

Comments
 (0)