This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:http/http.dart' as http; | |
| import 'dart:convert'; | |
| void main() async { | |
| final todo = await getTodoById(id: 1).then((data) { | |
| /// Парсинг в дто | |
| return data; | |
| }).onError((e, s) => null); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| final List a = List.generate(100, (i) => i); | |
| final List b = List.generate(100, (i) => i + 50); | |
| final c = [...a, ...b]; | |
| final Map<int, int> m = {for (final i in c) i.hashCode: i}; | |
| print(m.values.toList()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| final dateString = '22.01.1930'; | |
| final d = dateString.tryDateParse(); | |
| print(d); | |
| } | |
| extension DateParser on String { | |
| DateTime? tryDateParse() { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatefulWidget { | |
| const MyApp({super.key}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:async/async.dart'; | |
| void main(List<String> arguments) async { | |
| var l = ListDiffStreamUtility(); | |
| l.diffStream.listen((event) { | |
| print('DIFF IS ${event}'); | |
| }); | |
| l.stream.listen((event) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void main() { | |
| var list = List.generate(100, (i)=>MyItem(i) ); | |
| Map<int, MyItem> map = {}; | |
| for(var i in list) | |
| { | |
| map[i.id] = i; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:math'; | |
| void main() { | |
| var input = getSeriesOfNumbersWithAnOddNumberOfTimesEncounteredElement(10); | |
| } | |
| Iterable<int> getSeriesOfNumbersWithAnOddNumberOfTimesEncounteredElement(int length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "dart:async"; | |
| void main() async { | |
| final reconnector = Reconnector(Duration(seconds: 1), | |
| checker: checkConnect, reconnector: reconnect); | |
| reconnector.run(); | |
| await Future.delayed(Duration(seconds:12)); | |
| reconnector.stop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override |