Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro Exception caught by widgets library

Estou recebendo erro ao tentar executar os códigos conforme as aulas o código é:

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: TransferList(),
        appBar: AppBar(
          title: Text("Transferencias"),
        ),
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
        ),
      ),
    )
  );
}

class TransferList extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    throw Column(
      children: [
        Card(
            child: ListTile(
              leading: Icon(Icons.monetization_on),
              title: Text("Valor"),
              subtitle: Text("Conta"),
            )
        ),
        Card(
            child: ListTile(
              leading: Icon(Icons.monetization_on),
              title: Text("Valor"),
              subtitle: Text("Conta"),
            )
        ),
      ],
    );
  }

}

e o erro é: The following Column object was thrown building TransferList(dirty): Column(direction: vertical, mainAxisAlignment: center, crossAxisAlignment: center)

1 resposta
solução!

Por gentileza, tenta trocar o throw por return

class TransferList extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Column(
      children: [
        Card(
            child: ListTile(
              leading: Icon(Icons.monetization_on),
              title: Text("Valor"),
              subtitle: Text("Conta"),
            )
        ),
        Card(
            child: ListTile(
              leading: Icon(Icons.monetization_on),
              title: Text("Valor"),
              subtitle: Text("Conta"),
            )
        ),
      ],
    );
  }

}