Skip to content

Instantly share code, notes, and snippets.

View AlexKenbo's full-sized avatar
🎯
We will write a chat app =)

ALEKSANDR VASILEV AlexKenbo

🎯
We will write a chat app =)
View GitHub Profile
@AlexKenbo
AlexKenbo / factory-method-pattern.dart
Created November 1, 2019 15:37
Класс Shape создает новые объекты своего типа с заданными параметрами
import 'dart:math';
abstract class Shape {
factory Shape(String type) {
if (type == 'circle') return Circle(3);
if (type == 'square') return Square(2);
// To trigger exception, don't implement a check for 'triangle'.
throw 'Can\'t create $type.';
}
num get area;
@AlexKenbo
AlexKenbo / snippets_1.dart
Created June 21, 2019 10:00
[Dart snippets]
//Разложить отсортированные дни по неделям
Map<int,List> _createDaysByWeeks(DateTime from, DateTime to) {
/*
vacations/$ID/daysByWeeks/$weekNum/[$weekDay..]
vacations/$ID/vacationDays/$ID_DAY:true если в этом дне что-то запланированно
{
'$weekNum': ['$weekDay1','$weekDay2'],
};
*/