Home > OS >  A value of type 'TextSpan' can't be returned from the method 'build' becaus
A value of type 'TextSpan' can't be returned from the method 'build' becaus

Time:12-11

I need to create a custom SpanText, but i found this issue. A value of type 'TextSpan' can't be returned from the method 'build' because it has a return type of 'Widget'.

The Code Is:

class StareWidget extends StatelessWidget {
  const StareWidget({Key? key, required this.text}) : super(key: key);
  final String text;
  @override
  Widget build(BuildContext context) {
    return TextSpan();
  }
}

CodePudding user response:

According to image

  • Related