stringflutterdartapostrophe

How to disable Smart punctuation in flutter textfield ? Problem when a String contains the apostrophe sign : " s'habiller", "Brin d'herbe"


Am encountering a problem when a string contains an apostrophe (single quote). Am developing a vocabulary learning app (French / English). The user must answer quizzes. The phone tells the user if what he/she types is the correct translation. Whenever there is an apostrophe, the string is not recognized.

Ex : "A blade of grass" : "un brin d'herbe" / "A beehive" : "Un nid d'abeilles".

To check the answer, I split the chain into a list : [un,nid,d'abeilles] Even if the user types "d'abeilles", it's never recognized as correct.

I noticed the same problem with the speech to text functionality : if the user says the word "s'habiller" (to get dressed), it is never found by my search function.

Anyone sees why this happens ? Would it be a "flutter" bug ?

In the app, I have a wordbank which was created with Microsoft Excel and then imported into visual studio. The wordbank is made up of WORD objects that have a series of parameters. Here is the one for blade of grass.

Word(
    id: 37,
    level: 6,
    main: "blade of grass",
    mainFr: "brin d'herbe",
    theme: [
      T(
          e: "house",
          f: "maison",
          ste: ["in the garden"],
          stf: ["dans le jardin"]),
      T(
          e: "nature",
          f: "nature",
          ste: ["in the meadow"],
          stf: ["dans la prairie"])
    ],
    articleEng: "a",
    articleFr: "un",
    nature: "noun",
    plur: "blades of grass ",
    ortho2: "",
    phon: "ˈbleɪd əv ˈgrɑːs",
    son: "",
    remPhon: "",
    french: [],
    syn: [],
    ant: [],
    wDef: "a single thin flat piece of grass.",
    wPhrase: "There was no wind at all. Not a leaf or blade of grass moved.",
    wPhraseFr:
        "Il n'y avait pas de vent du tour. Pas une feuille ni un brin d'herbe ne bougeait.",
    past: [],
    idiomsEn: [],
    idiomsFr: [],
    marqueur: "",
    remarque: "",
  ),

Solution

  • I finally found the solution for this problem. It was indeed created with Apple's implementation of SMART PUNCTUATION. It is easy to disable it when using a textfield :

    TextFormField(
         smartQuotesType: SmartQuotesType.disabled,