OndrejKunc / flutter_dynamic_forms

A collection of flutter and dart libraries allowing you to consume complex external forms at runtime.
MIT License
204 stars 60 forks source link

Expressions crach on id containe "_" or "." #92

Closed mmmcorpsvit closed 3 years ago

mmmcorpsvit commented 3 years ago

Please add warning like this:

Warning! 
Id tag cannon contain "_" or "."!

i mean there

<textField id="user.First_Name" label="Enter your first name" value="super_user">    

this behavior crash expressions parser

OndrejKunc commented 3 years ago

I added _ as an allowed character in the identifier. The . cannot be used, because it can be used in the expressions to reference properties so there will be a conflict. I added this log to the parser, whenever there is a prohibited character:

  developer.log(
    'Warning: Invalid identifier \'$id\' for element type $TFormElement in FormElementParser.\n'
    'Only alphanumerics characters and underscores are allowed and identifiers cannot start with a number.',
    level: 900, // 900 relates to Warning according to the package:logging
  );

It is already merged and published together with the null safety version, so I am closing it now.