Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find function debugPrint()

In my Flutter project I have besides main.dart a second dart-file (helpers.dart) in which I am trying to use the debugPrint() function:

debugPrint(someString);

I get the following message:

The function 'debugPrint' isn't defined. Try importing the library that defines 'debugPrint', correcting the name to the name of an existing function, or defining a function named 'debugPrint'.

The official Flutter documentation states that the debugPrint function is part of Flutter's foundation library. But import 'package:flutter/foundation.dart'; did not solve the problem. So which library/ package do I have to import?

like image 612
Norman Avatar asked Sep 15 '25 20:09

Norman


1 Answers

Importing the material package solves the problem:

import 'package:flutter/material.dart';
like image 132
Norman Avatar answered Sep 18 '25 17:09

Norman