Skip to content

Ensure to initialize ScreenUtil before accessing it #196

@mehmetyilmaz001

Description

@mehmetyilmaz001

Hi all,

I am trying to implement flutter_screenutil like this in my project

`Widget build(BuildContext context) {

return MultiBlocProvider(
  providers: [

  ],
  child: StyledToast(

    child: ScreenUtilInit(
      designSize: Size(375, 812),
      allowFontScaling: true,
      child: MaterialApp(
          title: 'Material App',`

Bu when I restart the app in debug mode I got this error.

Ensure to initialize ScreenUtil before accessing it. Please execute the init method : ScreenUtil.init() 'package:flutter_screenutil/screenutil.dart': Failed assertion: line 33 pos 7: '_instance != null'

Bu when I Hot Reload the app the error is not showing.

I am using the version 4.0.2+3
Flutter version: 1.22.5

I attached a video about the error.

Thanks.

aa.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions