I want to use logger package provided by dart in my build method Implementation of logger I create a file at the top of the tree called constants.dart constants.dart
import 'package:logger/logger.dart';
var logger = Logger(
printer: PrettyPrinter(
methodCount: 0,
errorMethodCount: 5,
lineLength: 50,
colors: true,
printEmojis: true,
printTime: true,
));
I Just import this file then I can use it PROBLEM
- I am only able to use
logger.d(_imageUrl);in the state class not in my build method
ERROR WHEN USING IN BUILD
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Edit Products'),
),
body: Padding(
padding: const EdgeInsets.all(17.0),
child: Form(
key: _saveFormKey,
child: SingleChildScrollView(
child: Column(
children: [
TextFormField(
initialValue: _initValues['title'],
logger.d('_imageUrl');
decoration: const InputDecoration(labelText: 'Title'),
textInputAction: TextInputAction.next,
validator: (value) {
This is how I use it in the build Inside TEXTFORMFIELD
ERROR MESSAGE
Too many positional arguments: 0 expected, but 1 found. Try removing the extra positional arguments, or specifying the name for named arguments.
Positional arguments must occur before named arguments. Try moving all of the positional arguments before the named arguments.