1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter OneContext error "OneContext not initiated! please use builder method"

Discussão em 'Mobile' iniciado por Stack, Outubro 1, 2024 às 12:52.

  1. Stack

    Stack Membro Participativo

    ### Hello, when I first run the application or restart it, this error appears in the console. I tried a few things but it didn't work. Any solution please?

    Also main.dart:

    void main() {
    WidgetsFlutterBinding.ensureInitialized();
    OneContext().key = GlobalKey<NavigatorState>();
    OnePlatform.app = () => const MyApp();
    }

    class MyApp extends StatelessWidget {
    const MyApp({super.key});

    @override
    Widget build(BuildContext context) {
    return Material(
    child: MaterialApp(
    title: ...,
    builder: OneContext().builder,
    navigatorKey: OneContext().key,
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
    colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
    useMaterial3: false,
    ),
    home: const HomePage()
    ),
    );
    }


    Flutter version: 3.22.2


    OneContext version: 4.0.0

    Continue reading...

Compartilhe esta Página