handleRegionCaching method
Implementation
handleRegionCaching(String event, RegionPosition region) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
late int beforeRegionLines;
late int inRegionLines;
late int newRegionlines;
if (region == RegionPosition.before) {
beforeRegionLines = event.split('\n').length;
inRegionLines = inController.text.split('\n').length + 1;
newRegionlines = inRegionLines + beforeRegionLines;
} else if (region == RegionPosition.inner) {
beforeRegionLines = beforeController.text.split('\n').length;
inRegionLines = event.split('\n').length + 1;
newRegionlines = inRegionLines + beforeRegionLines;
}
prefs.setString(
widget.path,
'$beforeRegionLines:$newRegionlines',
);
}