Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
import 'dart:convert'; | |
import 'package:crypto/crypto.dart'; | |
import 'package:meta/meta.dart'; | |
/// {@template jwt} | |
/// A JWT token consists of three parts: the header, | |
/// the payload, and the signature or encryption data. | |
/// The first two elements are JSON objects of a specific structure. | |
/// The third element is calculated based on the first two |
void main() => runZonedGuarded<void>( | |
() => runApp(const App()), | |
(error, stackTrace) => log('Top level exception $error'), | |
); | |
class App extends StatelessWidget { | |
const App({super.key}); | |
@override | |
Widget build(BuildContext context) => MaterialApp( |
/// 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 { |
// ignore_for_file: curly_braces_in_flow_control_structures | |
/* | |
* Performance benchmark of different ways to append data to a list. | |
* https://gist.github.com/PlugFox/9849994d1f229967ef5dc408cb6b7647 | |
* | |
* BytesBuilder | builder.add(chunk) | 7 us. | |
* AddAll | list.addAll(chunk) | 594 us. | |
* Spread | [...list, ...chunk] | 1016446 us. | |
* Concatenation | list + chunk | 1005022 us. |
FROM dart:stable AS build_dart | |
WORKDIR /app | |
COPY ./tool/ ./tool/ | |
RUN dart compile exe tool/web_env.dart -o tool/web-env | |
FROM plugfox/flutter:stable-web AS build_web |
import 'package:flutter/foundation.dart' show Listenable, ValueListenable, VoidCallback, ChangeNotifier; | |
/// Selector from [Listenable] | |
typedef ListenableSelector<Controller extends Listenable, Value> = Value Function( | |
Controller controller, | |
); | |
/// Filter for [Listenable] | |
typedef ListenableFilter<Value> = bool Function(Value prev, Value next); |
/* | |
* Dart data class example | |
* https://gist.github.com/PlugFox/6a6d73a7822001af7f8558df89dbc60d | |
* https://dartpad.dev/6a6d73a7822001af7f8558df89dbc60d | |
* Matiunin Mikhail <plugfox@gmail.com>, 16 May 2022 | |
*/ | |
import 'package:meta/meta.dart'; | |
void main() => |
/* | |
* Custom progress indicator | |
* https://gist.github.com/PlugFox/d2274f2d4278473774b79b0020cbd618 | |
* https://dartpad.dev/d2274f2d4278473774b79b0020cbd618 | |
* Matiunin Mikhail <plugfox@gmail.com>, 1 May 2022 | |
*/ | |
import 'dart:async'; | |
import 'dart:math' as math; |
# ------------------------------------------------------ | |
# Dockerfile | |
# ------------------------------------------------------ | |
# image: gitlab-registry.domain.tld/mobile/app/flutter | |
# authors: plugfox@gmail.com | |
# license: MIT | |
# ------------------------------------------------------ | |
ARG VERSION="stable" |