FairWidget constructor

FairWidget({
  1. Key? key,
  2. String? name,
  3. String? path,
  4. Map<String, dynamic>? data,
  5. WidgetBuilder? holder,
  6. FairDelegate? delegate,
  7. bool? wantKeepAlive = false,
})

Implementation

FairWidget({
  Key? key,
  this.name,
  this.path,
  this.data,
  this.holder,
  this.delegate,
  this.wantKeepAlive = false,
})  : assert(!(name == null && path == null), 'FairWidget require a global registered `name` or bundle `path`'),
      assert(() {
        if (data == null) return true;
        if (!(data is Map && data.values.every((e) => e is int || e is double || e is String))) {
          log('data must be a map of primary value such as int, double or String. Object reference can be broken!');
        }
        return true;
      }(), ''),
      super(key: key);