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
/* | |
* Simplified navigator that allows to change the pages declaratively. | |
* https://gist.github.com/PlugFox/053d267fe59bc65da0d6fb9e9dd7e374 | |
* https://dartpad.dev?id=053d267fe59bc65da0d6fb9e9dd7e374 | |
* Mike Matiunin <plugfox@gmail.com>, 01 April 2024 | |
*/ | |
import 'dart:async'; | |
import 'dart:collection'; |
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
/* | |
* Dart StackOverflow | |
* https://gist.github.com/PlugFox/e74d16fbf4508fb1366ef2b4d2eab6e6 | |
* https://dartpad.dev?id=e74d16fbf4508fb1366ef2b4d2eab6e6 | |
* Mike Matiunin <plugfox@gmail.com>, 23 March 2024 | |
*/ | |
import 'dart:convert'; | |
const depth = 10000; |
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
#Область JSON | |
Функция СериализоватьJSON(Данные, ФункцияПреобразования = "ФункцияПреобразованияJSON") Экспорт | |
ЗаписьJSON = Новый ЗаписьJSON; | |
ЗаписьJSON.УстановитьСтроку(); | |
НастройкиСериализации = Новый НастройкиСериализацииJSON(); | |
НастройкиСериализации.СериализовыватьМассивыКакОбъекты = Ложь; | |
НастройкиСериализации.ФорматСериализацииДаты = ФорматДатыJSON.ISO; | |
НастройкиСериализации.ВариантЗаписиДаты = ВариантЗаписиДатыJSON.ЛокальнаяДатаСоСмещением; | |
ЗаписатьJSON(ЗаписьJSON, Данные, НастройкиСериализации, ФункцияПреобразования, веб_сериализация); | |
Возврат ЗаписьJSON.Закрыть(); |
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:database/src/platform/io.dart' | |
// ignore: uri_does_not_exist | |
if (dart.library.html) 'package:database/src/platform/js.dart'; | |
import 'package:database/src/queries.dart'; | |
import 'package:drift/drift.dart'; | |
import 'package:meta/meta.dart'; | |
part 'database.g.dart'; | |
/// Key-value storage interface for SQLite database |
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
/* | |
* Stream async expand | |
* https://gist.github.com/PlugFox/0366eb6d7bd2f3e03fd629c5a96ea8ff | |
* https://dartpad.dev?id=0366eb6d7bd2f3e03fd629c5a96ea8ff | |
* Mike Matiunin <plugfox@gmail.com>, 07 March 2024 | |
*/ | |
import 'dart:async'; | |
import 'package:flutter/material.dart'; |
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
/// Dependencies | |
abstract interface class Dependencies { | |
/// The state from the closest instance of this class. | |
factory Dependencies.of(BuildContext context) => InheritedDependencies.of(context); | |
/// Database | |
abstract final Database database; | |
} | |
final class $MutableDependencies implements Dependencies { |
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
/* | |
* Phone formatter | |
* https://gist.github.com/PlugFox/198e8b02565541cfaec4e7e4e1d1359c | |
* https://dartpad.dev/198e8b02565541cfaec4e7e4e1d1359c | |
* | |
* ^(?<country>8|\+7|\+375)?[\-\s\.]*[(]?s?(?<region>[0-9]{1,5})s?[)]?[\-\s\.]*(?<abonent1>[\d]{2,5})[\-\s\.]*(?<abonent2>[\d]{2})[\-\s\.]*(?<abonent3>[\d]{2})[\s]+((доб|#|ext|вн)[а-яa-z\.]{0,7}[\s]?(?<ext>[\d]{1,5})?)?$ | |
*/ | |
/// Source phones | |
const List<String> phones = <String>[ |
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
/// Base interface | |
import 'remote_config_base.dart'; | |
/// Conditional import | |
import 'remote_config_mobile.dart' | |
// ignore: uri_does_not_exist | |
if (dart.library.html) 'remote_config_web.dart'; | |
... | |
final config = await getRemoteConfig(); |
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
/* | |
* Date time parse and format as ISO-8601 with local timezone | |
* https://gist.github.com/PlugFox/339bcd8dbec29a56fd53f8e0656e4a54 | |
* https://dartpad.dev/339bcd8dbec29a56fd53f8e0656e4a54?id=&null_safety=true | |
*/ | |
import 'dart:async'; | |
import 'package:intl/intl.dart' as intl; | |
const String source = '2021-01-02T03:08:04+02:30'; |
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
/* | |
* Generate from CSV, TSV | |
* https://gist.github.com/PlugFox/d488cef8f605e5b7ea3433d49fd21f00 | |
* https://dartpad.dev/d488cef8f605e5b7ea3433d49fd21f00?id=&null_safety=true | |
*/ | |
import 'dart:math' as math; | |
void main() { | |
final list = data.split('\n').toList(); | |
final space = ' '.codeUnits.first; |