Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:async' show Future;
- import 'package:flutter/services.dart' show rootBundle;
- import 'dart:convert';
- import 'package:flutter_json/profil.dart';
- class User{
- Future<String> _loadProfilAsset() async {
- return await rootBundle.loadString('assets/profile.json');
- }
- Future loadProfil() async {
- String jsonString = await _loadProfilAsset();
- final jsonResponse = json.decode(jsonString);
- Profil profil = new Profil.fromJson(jsonResponse);
- print(profil);
- print(profil.nama);
- print(profil.alamat);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement