Skip to content

Instantly share code, notes, and snippets.

View gboliknow's full-sized avatar
🏠
Working from home

Gbolahan Adekoye gboliknow

🏠
Working from home
View GitHub Profile
@gboliknow
gboliknow / gist:0e47fdf8a8997d3a35bfd1c6af47792f
Created June 25, 2023 22:17
How to solve issue with surrogate string in flutter and UTF-16
String get _getSubstringWithSurrogatePairs {
final substring = _text.substring(0, _maxTextLength);
final List<int> utf16Bytes = [...substring.codeUnits];
final int lastIndex = utf16Bytes.length - 1;
if (substring.length >= _maxTextLength) {
final int lastByte = utf16Bytes[lastIndex];
if (lastByte >= 56320 && lastByte <= 57343) {
// Last byte is a lower surrogate
class QuizWidget extends StatefulWidget {
const QuizWidget({
super.key,
required this.quizModel,
});
final QuizModel quizModel;
@override
State<QuizWidget> createState() => _QuizWidgetState();
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:spotapp/constant.dart';
class OnboardView extends StatefulWidget {
const OnboardView({Key? key}) : super(key: key);
@override
_OnboardViewState createState() => _OnboardViewState();
@gboliknow
gboliknow / .dart
Created November 25, 2021 22:55
slider
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:spot/constant.dart';
import 'package:google_fonts/google_fonts.dart';
class Spot extends StatelessWidget {
const Spot({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {