Home > Software engineering >  The named parameter 'builder' is required, but there's no corresponding argument.Try
The named parameter 'builder' is required, but there's no corresponding argument.Try

Time:08-24

I Got This Weird Error:

"The named parameter 'builder' is required, but there's no corresponding argument."

Anyone know it then pls Help me

@override 
  Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: const Text("Register"),
      ), 
    body:FutureBuilder(
      future: Firebase.initializeApp(
        options: DefaultfirebaseOptions.currentPlatform,
        );
    builder: (context,snapshot) {
      switch (snapshot.connectionState) {
        case ConnectionState.done:```

CodePudding user response:

From your snippet I can see a syntax error:

...
FutureBuilder(
  future: Firebase.initializeApp(
    options: DefaultfirebaseOptions.currentPlatform,
  ); // HERE, YOU SHOULD PUT A `,`
  builder: (context,snapshot) {
    ...
  }
...

Putting a ; there breaks the code analysis, which is why it tells you "Hey, I'm expecting a builder parameter there". The code should also expect you to write a , instead.

CodePudding user response:

Remove ; and put,

Cahnge from

body:FutureBuilder(
      future: Firebase.initializeApp(
        options: DefaultfirebaseOptions.currentPlatform,
        );

To

 body:FutureBuilder(
  future: Firebase.initializeApp(
    options: DefaultfirebaseOptions.currentPlatform,
    ),
  • Related