marquee
marquee copied to clipboard
Unexpected null value error on even simple widget
I am writing this widget
import 'package:flutter/material.dart';
import 'package:marquee/marquee.dart';
class TestScreen extends StatelessWidget {
const TestScreen({super.key});
@override
Widget build(BuildContext context) {
return Container(
child: SizedBox(
height: 50,
child: Marquee(
text: "Hello to this is sample marquee",
crossAxisAlignment: CrossAxisAlignment.center,
blankSpace: 20,
),
),
);
}
}
Eventhough the app runs and displays the marquee in terminal following error is shown
Error: Unexpected null value.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/priv
ate/ddc_runtime/errors.dart 266:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/priv
ate/ddc_runtime/operations.dart 528:63 nullCheck
packages/flutter/src/widgets/scroll_position.dart 141:49
get minScrollExtent
packages/flutter/src/widgets/scroll_position.dart 668:18
[_updateSemanticActions]
packages/flutter/src/widgets/scroll_position.dart 984:5
notifyListeners
packages/flutter/src/widgets/scroll_position.dart 384:5
forcePixels
packages/flutter/src/widgets/scroll_position_with_single_context.dart 197:7
jumpTo
packages/flutter/src/widgets/scroll_controller.dart 172:15
jumpTo
packages/marquee/marquee.dart 548:23
<fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patc
h/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patc
h/async_patch.dart 123:5 _async
packages/marquee/marquee.dart 544:51
<fn>
packages/flutter/src/scheduler/binding.dart 1175:15
[_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1113:9
handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1015:5
[_handleDrawFrame]
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platfor
m_dispatcher.dart 1168:13 invoke
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platfor
m_dispatcher.dart 219:5 invokeOnDrawFrame
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/initial
ization.dart 195:45 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/priv
ate/ddc_runtime/operations.dart 334:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/priv
ate/ddc_runtime/operations.dart 339:39 dcall
Why is this happening and how to resolve this?
@MarcelGarus
Interesting. I actually can't reproduce this – it works for me (this is the example application from the example
directory with your widget as the body):
Can you maybe post your entire example including the main
function?
@MarcelGarus I use a getx main function. very normal ones
import 'dart:math';
import 'package:flutter/services.dart';
import 'package:window_manager/window_manager.dart';
import 'constant/route_constant.dart';
import 'ui/view/second_home.dart';
import 'package:flutter/material.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'constant/get_pages_constant.dart';
void main() async {
try {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
]).then((value) => runApp(MyApp()));
await windowManager.ensureInitialized();
WindowOptions windowOptions = const WindowOptions(fullScreen: true);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
} catch (e) {}
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'MyApp',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.deepPurple,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
getPages: getPages,
initialRoute: RouteConstant.homeScreen,
home: const SecondHome(),
);
}
}
Also when I try to render marquee text dynamically, (Wrapped in OBX) the error throws
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
#0 ScrollPosition.minScrollExtent (package:flutter/src/widgets/scroll_position.dart:141:49)
#1 ScrollPosition._updateSemanticActions (package:flutter/src/widgets/scroll_position.dart:668:18)
#2 ScrollPosition.notifyListeners (package:flutter/src/widgets/scroll_position.dart:983:5)
#3 ScrollPosition.forcePixels (package:flutter/src/widgets/scroll_position.dart:384:5)
#4 ScrollPositionWithSingleContext.jumpTo (package:flutter/src/widgets/scroll_position_with_single_context.dart:202:7)
#5 ScrollController.jumpTo (package:flutter/src/widgets/scroll_controller.dart:172:16)
#6 _MarqueeState.initState.<anonymous closure> (package:marquee/marquee.dart:548:23)
#7 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#8 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
#9 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1076:5)
#10 _invoke (dart:ui/hooks.dart:145:13)
#11 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#12 _drawFrame (dart:ui/hooks.dart:112:31)