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?
Importing the material package solves the problem:
import 'package:flutter/material.dart';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With