How to use selectionColor and selectionHandleColor from TextSelectionThemeData?

Im getting error from selectionColor and selectionHandleColor.
I need these colors from TextSelectionThemeData to draw text selection.
In paint method,I have used these colors like,

    final TextSelectionThemeData selectionTheme = TextSelectionTheme.of(this.context);
    final Paint textPaint = Paint()
      ..color = selectionTheme.selectionColor;
    final Paint bubblePaint = Paint()
      ..color = selectionTheme.selectionHandleColor;

Im getting error like,
‘dart:ui/painting.dart’: Failed assertion: line 1147: ‘<optimized out>’: is not true.

Kindly help me to overcome this issue.