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
| part 'counter.g.dart'; | |
| class Counter = _Counter with _$Counter; | |
| abstract class _Counter with Store { | |
| @observable | |
| int value = 0; | |
| @action | |
| void increment() { |
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
| void main() { | |
| test( | |
| 'When increment counter at 0 ' | |
| 'should return 1', () { | |
| final counter = Counter(); | |
| expect(counter.value, 0); | |
| counter.increment(); | |
| expect(counter.value, 1); |
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
| part 'cart.g.dart'; | |
| class Cart = _Cart with _$Cart; | |
| abstract class _Cart with Store { | |
| @observable | |
| List<CartItem> items = []; | |
| @action | |
| void addItem(CartItem item) => items.add(item); |
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
| void main() { | |
| test( | |
| 'When add a item ' | |
| 'should contains that item', () { | |
| final cart = Cart(); | |
| final item = CartItem('test'); | |
| cart.addItem(item); | |
| expect(cart.items.length, 1); |
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 'package:flutter_mobx/flutter_mobx.dart'; | |
| import 'package:mobx/mobx.dart'; | |
| part 'counter.g.dart'; | |
| class Counter = CounterBase with _$Counter; | |
| abstract class CounterBase with Store { | |
| @observable |
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'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', | |
| debugShowCheckedModeBanner: false, |
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 CounterBloc { | |
| int _contador = 0; | |
| final _controlador = StreamController(); | |
| } |
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 CounterBloc { | |
| int _counter = 0; | |
| final _controlador = StreamController(); | |
| Stream get saida => _controlador.stream; | |
| } |
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
| Widget listView() { | |
| final statement = groupBy( | |
| transactions, | |
| (transaction) => TransactionViewModel( | |
| transaction: transaction, | |
| ).formattedDate(context), // function to format data | |
| ); | |
| return ListView.builder( | |
| itemCount: statement.length, |
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 'package:mocking_dependencies_on_widget_testing/src/home_controller.dart'; | |
| import 'package:provider/provider.dart'; | |
| class HomePage extends StatefulWidget { | |
| @override | |
| _HomePageState createState() => _HomePageState(); | |
| } | |
| class _HomePageState extends State<HomePage> { |
OlderNewer