This file contains 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 categoryName = []; | |
categoryName.addAll(['one', 'thwo', 'thwo', 'thwo', 'three', 'one']); | |
print('categoryName before removing duplicates:'); | |
print(categoryName); | |
final unicCategory = categoryName.toSet().toList(); |
This file contains 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:golden_toolkit/golden_toolkit.dart'; | |
/// Пример как создать голден тест для бесконечной анимации. | |
/// | |
/// Если вкрадце, создаём обычный голден, а затем в функции screenMatchesGolden | |
/// объявляем customPump в котором задаём через какое время мы хотим сделать снимок. | |
void main() { | |
testGoldens('Infinity animation', (tester) async { | |
final builder = GoldenBuilder.column() |
This file contains 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
/// Изменение размера, разворот изображения. | |
/// | |
/// Чтобы изображение не искажалось преобразование происходит | |
/// по высоте (или ширине, в зависимости от соотношения [image.width]/[image.height]). | |
/// | |
/// Дальнейшее выравнивание под размеры (заполнение матрицы) происходит | |
/// в методе _getEncodeInputTensor. | |
Image prepareImage( | |
Image image, { |
This file contains 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() async { | |
// Что делать если нужно список с nullable значениями присвоить переменной к списку с not nullable? | |
// Исходные данные - список с nullable значениями. | |
final nullableList = [null, 1, 2, null, 3, 4]; // RuntymeType is List<int?> | |
// 1) Удалили все null: | |
nullableList.removeWhere((e) => e == null); // но тип всё еще List<int?>. | |
// 2) Как не надо делать: |
This file contains 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 { | |
static const withHeight = TextStyle( | |
fontSize: 22, |
This file contains 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 { | |
MyApp({Key? key}) : super(key: key); | |
@override |