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 of 'example_cubit.dart'; | |
| class ExampleState extends Equatable { | |
| final String text; | |
| const ExampleState(this.text); | |
| ExampleState copyWith({String? text}) { | |
| return ExampleState(text ?? this.text); | |
| } |
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:bloc/bloc.dart'; | |
| import 'package:equatable/equatable.dart'; | |
| part 'example_state.dart'; | |
| class ExampleCubit extends Cubit<ExampleState> { | |
| ExampleCubit() : super(ExampleState("")); | |
| changeText(String value) { | |
| emit(state.copyWith(text: value)); |
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:cubit_example/screens/cubit_example_screen/cubit/example_cubit.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_bloc/flutter_bloc.dart'; | |
| class CubitExampleScreen extends StatelessWidget { | |
| final ExampleCubit cubit = ExampleCubit(); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: BlocBuilder<ExampleCubit, ExampleState>( |
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'; | |
| class SetStateScreen extends StatefulWidget { | |
| @override | |
| _SetStateScreenState createState() => _SetStateScreenState(); | |
| } | |
| class _SetStateScreenState extends State<SetStateScreen> { | |
| String text = ""; | |
| @override |
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
| dart pub outdated --mode=null-safety |
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
| flutter upgrade | |
| flutter pub get | |
| flutter --version |
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
| environment: | |
| sdk: '>=2.12.0 <3.0.0' |