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'; | |
| import 'mutator.dart'; | |
| import 'state.dart'; | |
| void main() { | |
| runApp(VMSApp()); | |
| } | |
| class VMSApp extends StatelessWidget { | |
| build(context) { |
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 'dart:async'; | |
| class ScreenState { | |
| final valueElementState = _ElementState(value: 0); | |
| /// Global state describes a screen state | |
| } | |
| class _ElementState{ | |
| /// Element state describes a view state |
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 'state.dart'; | |
| enum Actions{ Increment } | |
| class Mutator { | |
| mutateState(action) { | |
| switch(action){ | |
| case Actions.Increment : { | |
| state.valueElementState.value++; | |
| state.valueElementState.valueBroadcaster |
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'; | |
| import 'dart:async'; | |
| main() { | |
| final state = State(); | |
| final mutator = Mutator(state); | |
| runApp(MyApp(state: state, mutator: mutator)); | |
| } | |
| class State { |
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
| main() async { | |
| final broadcaster = StreamController.broadcast(); | |
| broadcaster.stream | |
| .asyncExpand((data) => | |
| Stream.fromFuture(Future.delayed(Duration(seconds: 10), () { | |
| return data; | |
| }))) | |
| .listen((onData) { | |
| print(onData); | |
| }); |
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 Bloc { | |
| final broadcaster1 = StreamController<Model1>.broadcast(); | |
| final broadcaster2 = StreamController<Model2>.broadcast(); | |
| Stream<Model1> get stream1 => broadcaster1.stream; | |
| Stream<Model2> get stream2 => broadcaster2.stream; | |
| Bloc(){ | |
| subscribe(); |
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 BlocInjector extends InheritedWidget { | |
| BlocInjector({ | |
| Key key, | |
| @required Widget child, | |
| @required this.bloc, | |
| }) : super(key: key, child: child); | |
| final Bloc bloc; | |
| static BlocInjector of(BuildContext context) => |
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
| library example; | |
| import 'dart:isolate'; | |
| import 'package:built_redux/built_redux.dart'; | |
| import 'package:built_value/built_value.dart'; | |
| part 'example.g.dart'; | |
| void main() async { |
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 'dart:math'; | |
| import 'package:built_collection/built_collection.dart'; | |
| import 'package:flutter_test/flutter_test.dart'; | |
| const iterations = 100000; | |
| void main() { | |
| test("test", () async { | |
| final numbers = List.generate(iterations, (index) => index); |
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
| /// Data layer | |
| // api | |
| enum Mode { | |
| mock, | |
| stage | |
| } | |
| abstract class FireBaseApi { |
OlderNewer