Can you help me solving this error in flutter , which says 'Error: Can't access 'this' in a field initializer.'?

Advertisements Here is my code: The error is at line : onTap: () => _showActionSheet(this.context), I don’t know whats the problem is with this line as I’m a beginner in the flutter. So please help me solving this error. >Solution : Firstly, you may use method instead of variable for this. List<Marker> _list()=>[…] You can… Read More Can you help me solving this error in flutter , which says 'Error: Can't access 'this' in a field initializer.'?

How to set gradient color to Container's border in flutter

Advertisements I’m trying to set gradient color to container’s border line, here is the example i need. here is my code. Container( height: 50, width: 140, decoration: BoxDecoration( border: Border.all( color: Colors.black ), borderRadius: BorderRadius.circular(30), color: Colors.white ), child: const Center( child: Text( ‘Sign in’, style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black, ), ),… Read More How to set gradient color to Container's border in flutter

Flutter call function of another widget

Advertisements I try to call a function named _callMe from AlertDialog . this is my example code : import ‘package:flutter/material.dart’; void main() { runApp(const MainApplication()); } class MainApplication extends StatelessWidget { const MainApplication({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: false, title: "Training", home: HomePage(), ); } } class… Read More Flutter call function of another widget

Flutter error : A value of type 'OutletListModel' can't be assigned to a variable of type 'List<OutletListModel>?'

Advertisements I have a error "A value of type ‘OutletListModel’ can’t be assigned to a variable of type ‘List?’" so how to resolve this error List<OutletListModel>? selectedData; >Solution : change the code line where the error appears with: selectedData = [OutletListModel.fromJson(value.toJson())]; because selectedData expects an Array of OutletListModel;

flutter: type 'String' is not a subtype of type 'int' of 'index'

Advertisements I try to get a list of youtube categories with flutter. But i get this message all the time. I’m not very good with models and factory’s yet so i hope you can point in the right direction. This is my model: class YoutubeCategory { String? catagoryId; String catagoryName; String catagoryPosterUrl; String catagoryPostDate; YoutubeCategory(… Read More flutter: type 'String' is not a subtype of type 'int' of 'index'

Missing concrete implementation of 'StatefulWidget.createState' flutter

Advertisements Show me problem when run the app this my code : https://codeshare.io/eV6dyl add abstract before class Login >Solution : try this: class Login extends StatefulWidget { const Login({super.key}); @override State<Login> createState() => _LoginState(); } class _LoginState extends State<Login> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Login"), ), body: Container(child: Text("Login")),… Read More Missing concrete implementation of 'StatefulWidget.createState' flutter