Skip to content

Commit

Permalink
Add user model class
Browse files Browse the repository at this point in the history
  • Loading branch information
sbis04 committed Feb 23, 2021
1 parent fa037db commit 706fb98
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/model/user.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:convert';

import 'package:flutter_riverpod_sample/model/user_data.dart';
import 'package:json_annotation/json_annotation.dart';

part 'user.g.dart';

@JsonSerializable()
class User {
User({
this.data,
});

UserData data;

factory User.fromRawJson(String str) => User.fromJson(json.decode(str));

factory User.fromJson(Map<String, dynamic> json) => User(
data: UserData.fromJson(json["data"]),
);
}
19 changes: 19 additions & 0 deletions lib/model/user.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 706fb98

Please sign in to comment.