I have some old code which I migrated from Android Chipmonk do Ladybug by manually copying the folders from the old version to the new ones as my old mac was defect. Now I m facing lots of errors now which I cant resolve. Even lots of research work didn
t bring any better results. I`m happy for any help. I use this widget folder to have a centralspot for all the widgets which I call in other parts of the program
1.
Error: Expected a class member, but got 'extends'.
class CustomInfoIconButton extends StatelessWidget {
2.
lib/Widgets/Widgets.dart:260:38: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class CustomInfoIconButton extends StatelessWidget {
This is my code:
import 'package:esosba_app/Hauptmenü.dart.dart';
import 'package:flutter/material.dart';
import 'package:esosba_app/l10n/l10n.dart';
import 'package:esosba_app/locale_provider/locale_provider.dart';
import 'dart:ui'as ui;
import 'package:provider/provider.dart';
import 'package:torch_light/torch_light.dart';
//Infobutton in Listwidget
class CustomInfoIconButton extends StatelessWidget {
const CustomInfoIconButton({super.key});
@override
Widget build(BuildContext context) {
return const Icon(
Icons.info_outlined,
size: 40,
color: Colors.orange,
);
}
}
I tried different writings of the imports and checked my writing of the classes. unfortunately I couldn't see any wrong code as it worked in the earlier versions.
I have some old code which I migrated from Android Chipmonk do Ladybug by manually copying the folders from the old version to the new ones as my old mac was defect. Now I m facing lots of errors now which I cant resolve. Even lots of research work didn
t bring any better results. I`m happy for any help. I use this widget folder to have a centralspot for all the widgets which I call in other parts of the program
1.
Error: Expected a class member, but got 'extends'.
class CustomInfoIconButton extends StatelessWidget {
2.
lib/Widgets/Widgets.dart:260:38: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
class CustomInfoIconButton extends StatelessWidget {
This is my code:
import 'package:esosba_app/Hauptmenü.dart.dart';
import 'package:flutter/material.dart';
import 'package:esosba_app/l10n/l10n.dart';
import 'package:esosba_app/locale_provider/locale_provider.dart';
import 'dart:ui'as ui;
import 'package:provider/provider.dart';
import 'package:torch_light/torch_light.dart';
//Infobutton in Listwidget
class CustomInfoIconButton extends StatelessWidget {
const CustomInfoIconButton({super.key});
@override
Widget build(BuildContext context) {
return const Icon(
Icons.info_outlined,
size: 40,
color: Colors.orange,
);
}
}
I tried different writings of the imports and checked my writing of the classes. unfortunately I couldn't see any wrong code as it worked in the earlier versions.
Share Improve this question asked Jan 29 at 14:18 datavinniedatavinnie 571 silver badge8 bronze badges 2- 1 You might be missing a curly bracket somewhere. There is no syntax error in the code you posted above. – Dan R Commented Jan 29 at 15:33
- From the error code, i can see a presence of line 260 but in the code its less than 50 lines of code. 1. Could you please try invalidating cache and restart and if its not working 2. repair IDE. Both the options are available in the Toolbar -> File also , Instead of manually copying files separately just zip / compress / archive it and use it in your new computer – albert Commented Jan 29 at 16:45
1 Answer
Reset to default 0I found the issue in line 1 I should have written import 'package:esosba_app/Hauptmenü.dart instead of import 'package:esosba_app/Hauptmenü.dart.dart