Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

A value of type '_ChangeCountryPageState' can't be returned from the method 'createState' because it has a return type of 'State<ChangeCountryPage>'

import 'package:ecommerce_int2/app_properties.dart';
import 'package:ecommerce_int2/screens/settings/change_country.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class ChangeLanguagePage extends StatefulWidget {
  const ChangeLanguagePage({super.key});

  @override
  State<ChangeCountryPage> createState() => _ChangeCountryPageState();
}

This is the snippit to my code. This page is suppose to help select Different languages from a pre-given list but I’m getting this error

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You haven’t showed it but _ChangeCountryPageState needs to extend State<ChangeCountryPage> so like

class _ChangeCountryPageState extends State<ChangeCountryPage> {

The error must mean that you are not doing that.

But it also seems you are mixing up two pages. This is ChangeLanguagePage but you are returning State<ChangeCountryPage> for the createState() but this should be State<ChangeLanguagePage> then

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading