skip to Main Content

In my application I have an API that returns a mask, it can be CEP, CNPJ, CPF, whatever, the user that will choose.
What I want is to see how I can put a mask to fit the mask placed in the API.

This is how my API data comes:

  {
        "id": 26934,
        "label": "Campo de Texto - Com Máscara",
        "required": true,
        "type": "T",
        "mascara": "99999-999",
        "formatacao": "S",
        "format": "S",
        "originalFormat": "S",
        "html5Input": false,
        "codcampodinamico": 26934,
        "fieldSize": "M",
        "value": null,
        "values": []
    },

here is my code:

but when I do it this way, when I go to type in my field, it doesn’t let me type anything, I click on the key and it just adds the 99999-999

2

Answers


  1. Chosen as BEST ANSWER

    Good afternoon, I managed to solve it, as my API returned 9999 .. it did not understand the nines as a mask so I did this:

    ` mask: form.mask,

    filter: {"9": RegExp('')}

    type: MaskAutoCompletionType.lazy);`


  2. Try to add onChangedMethod on CompoUserSneha widget.

     onChanged: (value) {
         maskedController.text=value;
        },
    

    This may allow to change the value of 99999-999.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search