New post on /r/flutterdev subreddit:
Avoid reallocating objects by using global constants.
Hi fellow flutter devs ...I have problem with flutter performance.Consider You have stateless widget with number of objects in build methods, objects are immutable and will not be changed. But in every build or constructing object. the same data will be created. for example:class Foo extends StatelessWidget {final foo = SomeBigVarible();@override build(context){final bar = OtherBigVars();....}}foo and bar are immutable. every time Foo instance is created, same foo and bar should be allocated. So I decide to use foo and bar as global (static) variables. They will never change and I don't have intention to use them as global state (So Please don't mention me to study StatefulWidget's or something else I already know them, my problem is something else) .So my problem is how much convenient using global variables like this in flutter apps? I don't see any example using them. Every one literally put big chunk of objects in build or constructor method's. Could this become problem in cases like threading?
July 06, 2019 at 04:34PM by Howard_banister
https://ift.tt/2RXsCup
Avoid reallocating objects by using global constants.
Hi fellow flutter devs ...I have problem with flutter performance.Consider You have stateless widget with number of objects in build methods, objects are immutable and will not be changed. But in every build or constructing object. the same data will be created. for example:class Foo extends StatelessWidget {final foo = SomeBigVarible();@override build(context){final bar = OtherBigVars();....}}foo and bar are immutable. every time Foo instance is created, same foo and bar should be allocated. So I decide to use foo and bar as global (static) variables. They will never change and I don't have intention to use them as global state (So Please don't mention me to study StatefulWidget's or something else I already know them, my problem is something else) .So my problem is how much convenient using global variables like this in flutter apps? I don't see any example using them. Every one literally put big chunk of objects in build or constructor method's. Could this become problem in cases like threading?
July 06, 2019 at 04:34PM by Howard_banister
https://ift.tt/2RXsCup