Git Product home page Git Product logo

Comments (3)

bramp avatar bramp commented on June 13, 2024

A proposal would be to just suffix the variable with a underscore, so do_, in_, etc. This will still make it easy to discovery (with IDE autocompletion) and is minimally invasive.

I'll take a look at fixing this for you.

As a FYI If dart-lang/language#271 was approved, we could write `in`

from flutter_gen.

bramp avatar bramp commented on June 13, 2024

Ok, I spent a little more time on this than I should have :) (and I'm not a maintainer of this project, so I hope they accept the change). My PR is #433

There are a few other issues that cite similar problems, #250, and #346, that will be fixed by my PR.

The strategy is as follows:

  1. Convert the asset file name, to a valid dart identifier, that is
    • Replace non ASCII chars with ASCII.
    • Ensure the name starts with a letter (not number or _).
    • Style the name per the camelCase or snakeCase rules.
  2. Use the asset name without extension. If unique and not a dart reserved word use that.
  3. Use the asset name with extension. If unique and not a dart reserved word use that.
  4. If there are any collisions, append a underscore suffix to each item until they are unique.

from flutter_gen.

AlexV525 avatar AlexV525 commented on June 13, 2024

Ok, I spent a little more time on this than I should have :) (and I'm not a maintainer of this project, so I hope they accept the change). My PR is #433

There are a few other issues that cite similar problems, #250, and #346, that will be fixed by my PR.

The strategy is as follows:

  1. Convert the asset file name, to a valid dart identifier, that is

    • Replace non ASCII chars with ASCII.
    • Ensure the name starts with a letter (not number or _).
    • Style the name per the camelCase or snakeCase rules.
  2. Use the asset name without extension. If unique and not a dart reserved word use that.

  3. Use the asset name with extension. If unique and not a dart reserved word use that.

  4. If there are any collisions, append a underscore suffix to each item until they are unique.

I like the general strategy. Let's try it then we can find edges when users start using it, it's not a big deal.

from flutter_gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.