what is the error ? and how can i solve it?

Issue

I am learning flutter. i have made one app name chat x(title). the code is below

import 'package:flutter/material.dart';

void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
  @override
Widget build(BuildContext context) {
return MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: Text('Chat X'),
    ),
  body: Card(child: Column(children: <Widget>[
    Text('hey! this one is new');
  ],),),
  ),
);
 }
 }

when ever i want to debug this code i get this error

Expected to find ‘]’.

Solution

Remove ; from Text('hey! this one is new'); or you can place a , if you want to have more widgets inside Column

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Chat X'),
        ),
        body: Card(child: Column(children: <Widget>[
            Text('hey! this one is new'),
            Text('hey! this one is second new'),
          ],),),
    ),
    );
  }
}

Answered By – Ravinder Kumar

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.