was method
T
was(
- T model
Initializes a model copying the identity of supplied model
.
Usage:
final post = await repository.findOne('1'); // returns initialized post
final newPost = Post(title: 'test'); // uninitialized post
newPost.was(post); // new is now initialized with same key as post
Implementation
T was(T model) {
assert(model.isInitialized,
'Please initialize model before passing it to `was`');
return _initialize(model._adapters!, key: model._key, save: true);
}