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

[RESOLVIDO]initial_screen apresenta muitos erros mas nenhum tem um quick fix

Meu initial_screen:

import 'package:flutter/material.dart';
import 'package:nosso_primeiro_projeto/components/task.dart';
import 'package:nosso_primeiro_projeto/screens/form_screen.dart';
import 'package:nosso_primeiro_projeto/data/task_dao.dart';

class InitialScreen extends StatefulWidget {
  const InitialScreen({Key? key}) : super(key: key);

  @override
  State<InitialScreen> createState() => _InitialScreenState();
}

class _InitialScreenState extends State<InitialScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: Container(),
        title: const Text('Tarefas'),
      ),
      body: Padding(
          padding: const EdgeInsets.only(top: 8, bottom: 70),
          child: FutureBuilder<List<Task>>(
              future: TaskDao().findAll(),
              builder: (context, snapshot) {}
              List<Task>? items = snapshot.data;
              return ListView.builder(itemCount: items.length,
              itemBuilder: (BuilderContext context, int index) {
                final Task tarefa = items[index];
                return tarefa;
              });
      ),
    ),
    floatingActionButton: FloatingActionButton(
    onPressed: ()
    {
    Navigator.push(
    context,
    MaterialPageRoute(
    builder: (contextNew) =>
    FormScreen(
    taskContext: context,
    ),
    ),
    );
    },
    child: const Icon(Icons.add),
    )
    ,
    );
  }
}

está apresentando 11 erros mas fica só selecionado a linha do ListView.builder

igual o print:Insira aqui a descrição dessa imagem para ajudar na acessibilidade

e essa tela mostra isso: Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Mas nenhuma tem quickfix...

Eu troquei o projeto de pc, instalei os sdks, commandline, path no enviroment variables e meu flutter doctor está tudo correto, tanto que o app estava rodando antes dessa ultima aula.

Foi algo que fix errado?

quando tento rodar o app agora aparece a seguinte mensagem:

Launching lib\main.dart on SM A546E in debug mode...
Running Gradle task 'assembleDebug'...
lib/screens/initial_screen.dart:24:11: Error: Expected ',' before this.
          List<Task>? items = snapshot.data;
          ^^^^
lib/screens/initial_screen.dart:24:20: Error: A comparison expression can't be an operand of another comparison expression.
Try putting parentheses around one of the comparisons.
          List<Task>? items = snapshot.data;
                   ^
lib/screens/initial_screen.dart:24:21: Error: Expected an identifier, but got '?'.
Try inserting an identifier before '?'.
          List<Task>? items = snapshot.data;
                    ^
lib/screens/initial_screen.dart:24:44: Error: Expected ':' before this.
          List<Task>? items = snapshot.data;
                                           ^
lib/screens/initial_screen.dart:24:44: Error: Expected an identifier, but got ';'.
Try inserting an identifier before ';'.
          List<Task>? items = snapshot.data;
                                           ^
lib/screens/initial_screen.dart:24:44: Error: Expected ')' before this.
          List<Task>? items = snapshot.data;
                                           ^
lib/screens/initial_screen.dart:23:41: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
        child: FutureBuilder<List<Task>>(future: TaskDao().findAll()  , builder: (context,snapshot){}
                                        ^
/C:/flutter/packages/flutter/lib/src/widgets/async.dart:518:9: Context: Found this candidate, but the arguments don't match.
  const FutureBuilder({
        ^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1

alguém consegue enxergar o que fiz errado?

1 resposta
solução!

Ja resolvi, eu que esqueci de abrir uma chave