Senior
4 oktober 2026

Vind de bug: Flutter

Eén stukje code. Vind de bug, of bewijs dat er geen is.

dart
1import 'package:flutter/material.dart';
2
3class NavigationService {
4  static final NavigationService _instance = NavigationService._();
5  factory NavigationService() => _instance;
6  NavigationService._();
7
8  late BuildContext context;
9
10  void navigate(String route) {
11    Navigator.pushNamed(context, route);
12  }
13}
14
15class HomeScreen extends StatelessWidget {
16  
17  Widget build(BuildContext context) {
18    NavigationService().context = context;
19    return ElevatedButton(
20      onPressed: () => NavigationService().navigate('/details'),
21      child: const Text('Go'),
22    );
23  }
24}

Klik op de regels die het probleem veroorzaken.

Jouw oordeel

Eén poging per dag. Het antwoord verschijnt direct daarna.

Behoud je reeks

Maak een account om je reeks te behouden en je voortgang te volgen.

Account aanmaken