Uploaded image for project: 'Realm Dart SDK'
  1. Realm Dart SDK
  2. RDART-681

Add an option to generate required named param in the model's constructor

      Problem

      Currently, the way the models constructors are being generated are as follow:

      • late ObjectId id; // generates a positional parameter
      • late String? maybeDescription; // generates an named nullable parameter
      • late double milesTravelled = 0; // generates a named non-nullable parameter with a default value

      What if you wanted a non-nullable named parameter without a default value? (For example, if the default value is generated from a function call, and not a constant.) You're out of luck, you're stuck with positional params - which is fine when there are only a couple. When there are more than a couple of them, it becomes harder to manage. It would be nice to have an option to generate a required field.

      Solution

      Solution: Add a @Required PropertyAnnotation that will generate a required named param instead of a positional param

      Alternatives

      Alternative solution: Turn all positional parameter into required name parameter.

      How important is this improvement for you?

      I would like to have it but have a workaround

      Feature would mainly be used with

      Atlas App Services: Auth or Functions etc

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: