Cannot find function debugPrint()

244

Importing the material package solves the problem:

import 'package:flutter/material.dart';
Share:
244
Norman
Author by

Norman

Exploring App Development (Flutter, Android)

Updated on December 24, 2022

Comments

  • Norman
    Norman over 1 year

    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?