title: secondhalf is not been initialized
body: <p><a href="https://i.stack.imgur.com/vNH9u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vNH9u.png" alt="enter image description here" /></a></p>
  <p>some one help me for this issu i cant solve this issu . i think i'm initialized secondhalf but why this error .pls some one help me.some one help me for this issu i cant solve this issu . i think i'm initialized secondhalf but why this error .pls some one help me.why get me this error</p>
  <pre><code>class _ExpendedTextState extends State&lt;ExpendedText&gt; {
    late String firstHalf;
    late String secondHalf;
    bool hiddenText = true;
    double textHeight = Dimentions.screenHeight / 5.63;
  
    @override
    void initState() {
      super.initState();
      if (widget.text.length &gt; textHeight) {
        firstHalf = widget.text.substring(0, textHeight.toInt());
        secondHalf =
            widget.text.substring(textHeight.toInt() + 1, widget.text.length);
      }
    }
  
    @override
    Widget build(BuildContext context) {
      return secondHalf.isEmpty
          ? SmallText(text: firstHalf)
          : Column(
              children: [
                hiddenText
                    ? SmallText(
                        text: firstHalf + &quot;....&quot;,
                        color: AppColors.paraColor,
                        size: Dimentions.font16,
                        height: 1.6,
                      )
                    : SmallText(
                        text: firstHalf + secondHalf,
                        color: AppColors.paraColor,
                        size: Dimentions.font16,
                        height: 1.6),
                InkWell(
                  onTap: () {
                    setState(() {
                      hiddenText = !hiddenText;
                    });
                  },
                  child: Row(
                    children: [
                      SmallText(
                        text: 'Show more',
                        color: AppColors.mainColor,
                      ),
                      Icon(
                        hiddenText ? Icons.arrow_drop_down : Icons.arrow_drop_up,
                        color: AppColors.mainColor,
                      ),
                    ],
                  ),
                )
              ],
            );
    }
  }
  </code></pre>