Advertisement
juliarnasution

User.dart

Aug 11th, 2019
913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.54 KB | None | 0 0
  1. import 'dart:async' show Future;
  2. import 'package:flutter/services.dart' show rootBundle;
  3. import 'dart:convert';
  4. import 'package:flutter_json/profil.dart';
  5. class User{
  6.   Future<String> _loadProfilAsset() async {
  7.     return await rootBundle.loadString('assets/profile.json');
  8.   }
  9.   Future loadProfil() async {
  10.     String jsonString = await _loadProfilAsset();
  11.     final jsonResponse = json.decode(jsonString);
  12.     Profil profil = new Profil.fromJson(jsonResponse);
  13.     print(profil);
  14.     print(profil.nama);
  15.     print(profil.alamat);
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement