Skip to content

Instantly share code, notes, and snippets.

View sergeykondr's full-sized avatar

Sergey sergeykondr

  • Saint-Petersburg
View GitHub Profile
@sergeykondr
sergeykondr / main.dart
Last active February 12, 2023 03:35
microtask ex2
void main() async {
methodA();
await methodB();
await methodC('main');
methodD();
}
void methodA(){
print('sync A');
}
@sergeykondr
sergeykondr / main.dart
Last active February 12, 2023 03:34
microtask ex 1
void main() async {
methodA();
await methodB();
await methodC('main');
methodD();
}
void methodA(){
print('sync A');
}
@sergeykondr
sergeykondr / main.dart
Created November 29, 2021 00:00
блок 17-27 строчки идет в очередь event loop. это равноценно, если этот код обернуть в Future (пример далее будет).
void main() async {
methodA();
methodB(); //намеренно вызвано без await
methodA();
}
methodA() {
print('A');
}
@sergeykondr
sergeykondr / main
Created November 28, 2021 23:55
как будто обернули во фьюче и 1ую строчку вызвали сразу
void main() async {
methodA();
methodB(); //намеренно вызвано без await
methodA();
}
methodA() {
print('A');
}
void main() async {
methodA(1);
methodB('non'); //намеренно вызвано без await
methodA(2);
Future(() {
print('Future 1');
});
void main() async{
methodA();
methodB(); //намеренно вызвано без await
methodA();
}
methodA(){
print('A');
}
@sergeykondr
sergeykondr / BottomNavigationBar.dart
Last active October 13, 2020 15:34
BottomNavigationBar - setState()
/// Flutter code sample for BottomNavigationBar
// This example shows a [BottomNavigationBar] as it is used within a [Scaffold]
// widget. The [BottomNavigationBar] has three [BottomNavigationBarItem]
// widgets and the [currentIndex] is set to index 0. The selected item is
// amber. The `_onItemTapped` function changes the selected item's index
// and displays a corresponding message in the center of the [Scaffold].
//
// ![A scaffold with a bottom navigation bar containing three bottom navigation
// bar items. The first one is selected.](https://flutter.github.io/assets-for-api-docs/assets/material/bottom_navigation_bar.png)
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'dart:math' as math;
void main() {
runApp(
ChangeNotifierProvider(
create: (_) => ColorChangeNotifier(),
child: MyApp(),
),
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
@sergeykondr
sergeykondr / main.dart
Last active May 3, 2020 23:41
counter_app
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Counter',