[ad_1]
import 'package deal:flutter/materials.dart';
import './query.dart';
import './reply.dart';
void primary() {
runApp(MyFirstApp());
}
class MyFirstApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return _MyFirstAppState();
}
}
class _MyFirstAppState extends State<MyFirstApp> {
var _questionIndex = 0;
void _ansButtonPress() {
setState(() {
_questionIndex = _questionIndex + 1;
});
}
var questions = [
{
'questionText': 'What is your favorate Colour',
'answers': ['red', 'balck ', 'yellow', 'blue']
},
{
'questionText': 'What's your favorate Animal',
"solutions": ['Lion', 'Chettah ', 'Leopard', 'Cat']
},
{
'questionText': 'What's your favorate Film',
'solutions': ['hai', 'hello ', 'hoe', 'are you']
}
];
Widget construct(BuildContext context) {
return MaterialApp(
house: Scaffold(
appBar: AppBar(
title: Textual content('My first app '),
),
physique: Column(
youngsters: [
Question(
questions[_questionIndex]['questionText'],
),
Reply(_ansButtonPress),
Reply(_ansButtonPress),
Reply(_ansButtonPress),
],
),
),
);
}
}
terminal displaying like this
lib/primary.dart:49:24: Error: The operator ‘[]’ is not outlined for the
class ‘Set<Map<String, Object>>’.
– ‘Set’ is from ‘dart:core’.
– ‘Map’ is from ‘dart:core’.
– ‘Object’ is from ‘dart:core’.
Strive correcting the operator to an current operator, or defining a ‘[]’ operator.
questions[_questionIndex][‘questionText’],
^
Didn’t package deal /Customers/j3rry01/Paperwork/Flutter Lab/flutter fundamentals /new_flutter.
Command PhaseScriptExecution failed with a nonzero exit code
word: Utilizing new construct system
word: Planning
word: Construct preparation full
word: Constructing targets in parallel
warning: Capabilities for Signing & Capabilities could not operate appropriately as a result of its entitlements use a placeholder group ID. To
resolve this, choose a
improvement group within the Runner editor. (in goal ‘Runner’ from mission ‘Runner’)
i’m a newbie , not so good with the dart ideas , i do not see any error on my POV
[ad_2]

