datavinnie
datavinnie

Reputation: 57

Error: Classes can't be declared inside other classes

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 didnt 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.

Upvotes: 0

Views: 45

Answers (1)

datavinnie
datavinnie

Reputation: 57

I 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

Upvotes: 0

Related Questions