modular
modular copied to clipboard
If two routes are sent simultaneously, the args of the first route is replaced by the args of the second route: modular:5.0.3
InkWell(
child: _buttonItem(const Text('test'), () {
Modular.to.pushNamed('/first', arguments: 'first_data');
Modular.to.pushNamed('/second', arguments: 'second_data');
}),
),
class TestModule extends Module {
@override
final List<ChildRoute> routes = [
SettingRoute('/first', child: (_, args) {
print('log_first:${args.data}');
return FirstPage();
}),
SettingRoute('/second', child: (_, args) {
print('log_second:${args.data}');
return SecondPage();
})
];
}
When click the Test button, bothlog_first
and log_second
will print second_data
. The first_data
will be lost.
@FCAI7-ford I opened the same issue (https://github.com/Flutterando/modular/issues/877) some months ago. The problem is trickier to be solved the way the code is implemented and the problem persists in modular 6 (at least when I tested it). The problem is in a concurrency for a singleton variable for the args (which I didn't understand its use).
I could not figure out how to solve the problem to open a PR, waiting for someone from the package to be able to provide some more information or guidance.