--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Going the other direction is less straightforward; the most direct analog would be creating a Map<String, dynamic> from the public properties (and getters) of an object
In my ideal world, Dart would support a syntax that let a Map<String, dynamic> be supplied to any constructor's named arguments, where the String key maps to the argument name and the dynamic value maps to the argument value.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
I'm developing a serialization library that works in flutter so I'm avoiding Mirrors and would like to know what's possible with runtime generics in Dart/flutter to find out what needs to be code-gen'ed and what can be automated with generic routines.Firstly how can we can get the runtime time of a generic argument?T create<T>() {var runtimeTypeOfT = ... ?}
Is it possible to create a new instance of T where T has an empty constructor, e.g:T create<T>() {var instance = new T();return instance;}
Can we create a generic factory function which creates a generic list with the runtime argType?List createList(String argType) {var newGenericList = ... // create List<argType>?return newGenericList;}
As a current workaround/hack I'm generating a dictionary of factory constructors like:{'List<String>': () => new List<String>(),'Map<String,int>': () => new Map<String,int>(),}But I would like to avoid needing to do this and would like to be able to use a generic routine if possible.
--
Ian Hickson
😸
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Ian Hickson
😸