12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import 'dart:convert';
- import 'package:sport/generated/json/base/json_field.dart';
- import 'package:sport/generated/json/step_realtime_entity.g.dart';
- @JsonSerializable()
- class StepRealtimeEntity {
- late int id;
- @JSONField(name: "user_id")
- late int userId;
- late int start;
- late int end;
- late int step;
- late int motion;
- late int type;
- late int target;
- late int year = 0;
- late String data;
-
- StepRealtimeEntity();
- factory StepRealtimeEntity.fromJson(Map<String, dynamic> json) => $StepRealtimeEntityFromJson(json);
- Map<String, dynamic> toJson() => $StepRealtimeEntityToJson(this);
- @override
- String toString() {
- return jsonEncode(this);
- }
- List<List<int>> get motionData {
- List<List<int>> data = [];
- List<dynamic> v = json.decode(this.data);
- v.forEach((element) {
- List<int> value = [];
- element.forEach((vv) {
- value.add(vv as int);
- });
- data.add(value);
- });
- return data;
- }
- }
|