I have this code in flutter
late String firstHalf;
late String secondHalf;
bool hiddenText = true;
double textHeight = Diamension.screenHeight / 5.63;
@override
void iniState() {
super.initState();
if (widget.text.length > textHeight) {
firstHalf = widget.text.substring(0, textHeight.toInt());
secondHalf =
widget.text.substring(textHeight.toInt() + 1, widget.text.length);
} else {
firstHalf = widget.text;
secondHalf = "";
}
}
from the code you will see that I initialized "secondHalf" but I kept getting this error in debug
Exception has occurred.
LateError (LateInitializationError: Field 'secondHalf' has not been initialized.)