9
This commit is contained in:
parent
0790b41110
commit
f25c40280d
2 changed files with 7 additions and 27 deletions
|
@ -124,7 +124,7 @@ class $name extends MemoryModel {
|
||||||
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
|
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
|
||||||
|
|
||||||
factory $name.fromMap(Map data) => new $name(
|
factory $name.fromMap(Map data) => new $name(
|
||||||
id: data['id']
|
id: data['id'],
|
||||||
name: data['name'],
|
name: data['name'],
|
||||||
desc: data['desc']);
|
desc: data['desc']);
|
||||||
|
|
||||||
|
@ -141,33 +141,13 @@ class $name extends MemoryModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
_generateMemoryService(String name) {
|
_generateMemoryService(String name) {
|
||||||
|
var lower = _snake(name);
|
||||||
|
|
||||||
return '''
|
return '''
|
||||||
import 'package:angel_framework/defs.dart';
|
import 'package:angel_framework/defs.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
|
import '../models/$lower.dart';
|
||||||
/// Store in-memory instances of this class.
|
export '../models/$lower.dart';
|
||||||
class $name extends MemoryModel {
|
|
||||||
String name, desc;
|
|
||||||
|
|
||||||
$name({String id, this.name, this.desc}) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
|
|
||||||
|
|
||||||
factory $name.fromMap(Map data) => new $name(
|
|
||||||
id: data['id']
|
|
||||||
name: data['name'],
|
|
||||||
desc: data['desc']);
|
|
||||||
|
|
||||||
Map toJson() {
|
|
||||||
return {
|
|
||||||
'id': id,
|
|
||||||
'name': name,
|
|
||||||
'desc': desc
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Manages [$name] in-memory.
|
/// Manages [$name] in-memory.
|
||||||
class ${name}Service extends MemoryService<$name> {
|
class ${name}Service extends MemoryService<$name> {
|
||||||
|
@ -201,7 +181,7 @@ class $name extends Model {
|
||||||
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
|
factory $name.fromJson(String json) => new $name.fromMap(JSON.decode(json));
|
||||||
|
|
||||||
factory $name.fromMap(Map data) => new $name(
|
factory $name.fromMap(Map data) => new $name(
|
||||||
id: data['id']
|
id: data['id'],
|
||||||
name: data['name'],
|
name: data['name'],
|
||||||
desc: data['desc']);
|
desc: data['desc']);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_cli
|
name: angel_cli
|
||||||
version: 1.0.0-dev+8
|
version: 1.0.0-dev+9
|
||||||
description: Command-line tools for the Angel framework.
|
description: Command-line tools for the Angel framework.
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=1.19.0"
|
sdk: ">=1.19.0"
|
||||||
|
|
Loading…
Reference in a new issue