I am coding a website and an app for the same purpose. I am fluent at PHP but new to dart. Both, the website and the app call an API to get the data they should display. In PHP I am using a foreach loop to go through and echo a div for each key just like this:
# res is an example string for an api result
$res = '{"first":["ExampleTitle", "ExampleDescription"], "second":["ExampleT2", "ExampleD2"], "third":["ExpampleT3", "ExampleD3"]}';
$res = json_decode($res);
foreach ($res as $key => $value) {
echo '<div style="margin-bottom: 35px;">'.$value[0].'<br>'.$value[1].'</div>';
}
and the output looks like this:
ExampleTitle ExampleDescription ExampleT2 ExampleD2 ExpampleT3 ExampleD3
Now I want to do the same thing in the app using dart. How can I loop trough an object to create multiple containers?
In other words: what dart code would achieve the same thing the PHP code does, except instead of creating divs it creates containers?