MainApp send to page depending on value MainApp send to page depending on value dart dart

MainApp send to page depending on value


Here's a simple example of what you could do. I think you need to keep track of state in StarterPoint depending on whether or not you are logged in.

import 'package:flutter/material.dart';void main() {  runApp(MaterialApp(home: StarterPoint()));}class StarterPoint extends StatefulWidget {  @override  State<StatefulWidget> createState() => StarterPointState();}class StarterPointState extends State<StarterPoint> {  bool loggedIn = false;  @override  Widget build(BuildContext context) {    if (loggedIn) {      return Dashboard();    } else {      return Login(() => setState(() {            loggedIn = true;          }));    }  }}class Dashboard extends StatelessWidget {  @override  Widget build(BuildContext context) {    return Text('hello!');  }}class Login extends StatelessWidget {  final Function() callBack;  Login(this.callBack);  @override  Widget build(BuildContext context) {    return Column(children: [      RaisedButton(child: Text('press'), onPressed: () => callBack())    ]);  }}