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
// ignore_for_file: avoid-non-null-assertion, format-comment | |
import 'package:flutter/material.dart'; | |
import 'package:theme_tailor_annotation/theme_tailor_annotation.dart'; | |
part 'app_base_theme.tailor.dart'; | |
/// Базовая тема приложения, содержащая основные переменные дизайна. | |
/// Генерируется на основе данных Figma. | |
@TailorMixin() |
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
class User { | |
final int level; | |
final String type; | |
final String name; | |
const User({required this.level, required this.type, required this.name}); | |
@override | |
String toString() { | |
return 'User{level: $level, type: $type, name: $name}'; |
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'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@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 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
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() { | |
List<String> aListOfStrings = ['one', 'two', 'three']; | |
List<String> aNullableListOfStrings; | |
List<String> aListOfNullableStrings = ['one', null, 'three']; // Ошибка компиляции | |
print('aListOfStrings is $aListOfStrings.'); | |
print('aNullableListOfStrings is $aNullableListOfStrings.'); // Ошибка компиляции | |
print('aListOfNullableStrings is $aListOfNullableStrings.'); | |
} |
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() { | |
nonNullable(); | |
nullable(); | |
} | |
/// Ошибка компиляции | |
void nonNullable() { | |
int a; | |
a = null; | |
print('a is $a.'); |
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() { | |
fetchBestFoodWithCallback((food) => print(food)); | |
fetchBestFood().then((food) => print(food)); | |
// Неправильное использование future | |
print(fetchBestFood()); | |
} | |
// Пример с колбеком | |
void fetchBestFoodWithCallback(Function(String food) onComplete) { |
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() { | |
fetchBestFoodWithCallback((food) => print(food)); | |
fetchBestFood().then((food) => print(food)); | |
} | |
// Пример с колбеком | |
void fetchBestFoodWithCallback(Function(String food) onComplete) { | |
onComplete('Spaghetti'); | |
} |
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() { | |
hof( | |
isValue: true, | |
onValue: () => print('Value'), | |
onError: (result) => print(result), | |
); | |
} | |
void hof({ | |
required bool isValue, |