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
class StatelessExample extends StatelessWidget { | |
final int foo; | |
final int bar; | |
const StatelessExample({Key key, this.foo, this.bar}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Text('$foo $bar'); | |
} |
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
Widget statelessExample(BuildContext context, { Key key, int foo, int bar }) { | |
return Text('$foo $bar'); | |
} |
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/widgets.dart'; | |
import 'package:functional_widget_annotation/functional_widget_annotation.dart'; | |
part 'main.g.dart'; | |
@widget | |
Widget statelessExample({int foo, int bar}) { | |
return Text('$foo $bar'); | |
} |
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
part of 'main.dart'; | |
class StatelessExample extends StatelessWidget { | |
const Foo({Key key, this.foo, this.bar}) : super(key: key); | |
final int foo; | |
final int bar; | |
@override | |
Widget build(BuildContext _context) { |
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
enum CounterEvent { | |
increment, | |
decrement, | |
} | |
class Counter extends Store<int, CounterEvent> { | |
Counter() : super(initialState: 0); | |
@override | |
int reducer(int previousState, CounterEvent action) { |
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:vanilla/reducer_provider.dart'; | |
enum _Action { | |
increment, | |
decrement, | |
} | |
class MyStore extends ReducerStore<int, _Action> { | |
MyStore() : super(0); |
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
// ignore_for_file: public_member_api_docs | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:provider/single_child_widget.dart'; | |
/// A provider that exposes a [ValueNotifier] in two independent pieces. | |
/// | |
/// [StoreProvider] will expose both [ValueNotifier] and [ValueNotifier.value] independently | |
/// to its dependents. |
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
class BlocProvider<Value, Bloc extends _bloc.Bloc<dynamic, Value>> | |
extends ValueDelegateWidget<Bloc> implements SingleChildCloneableWidget { | |
/// Allows to specify parameters to [BlocProvider]. | |
BlocProvider({ | |
Key key, | |
@required ValueBuilder<Bloc> builder, | |
UpdateShouldNotify<Value> updateShouldNotify, | |
UpdateShouldNotify<Value> blocUpdateShouldNotify, | |
Disposer<Bloc> dispose, | |
Widget child, |
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
class UserDetails { | |
UserDetails(this.id); | |
final int id; | |
} | |
class User extends StatefulWidget { | |
const User({Key key, this.id, this.builder, this.child}) : super(key: key); | |
final int id; |
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
class ProviderToStream<T> extends StatefulWidget | |
implements SingleChildCloneableWidget { | |
const ProviderToStream({Key key, this.builder, this.child}) : super(key: key); | |
final ValueWidgetBuilder<Stream<T>> builder; | |
final Widget child; | |
@override | |
_ProviderToStreamState<T> createState() => _ProviderToStreamState<T>(); |
OlderNewer