0

Is the flutter functions (methods?) parameters are "by value" of "by reference"? Does different variable types have different approach ? for example(s)

1)   BlocProvider.of<CounterCubit>(context).dec();
2)   const MyApp({Key? key}) : super(key: key);
3)   CounterState(counterValue: state.counterValue+1)
4)   CounterState(counterClass: ClassA)

Another sample in following code:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
     ...

where the context variable value is created, does inside the build function and only after the returning from the build function the context has value, or somewhere else before...? Does the value of context variable before entering the build function is defined? where ?

Funder_Brk
  • 25
  • 4
  • I would direct you to https://stackoverflow.com/a/58975981/10821123 for the answer. I hope that helps. – Vaibhav Feb 15 '22 at 15:12
  • 1
    Does this answer your question? [Is Dart pass by reference?](https://stackoverflow.com/questions/58966090/is-dart-pass-by-reference) – Md. Yeasin Sheikh Feb 15 '22 at 15:19
  • It helps, thank you. I edit the post/question with another sample that I'm not sure where the initialization is happened and what value is transfer to the function build. – Funder_Brk Feb 15 '22 at 20:03

0 Answers0