Skip to content

Instantly share code, notes, and snippets.

View tomasbaran's full-sized avatar
📱
developing a mobile app

Tomas Baran tomasbaran

📱
developing a mobile app
View GitHub Profile
@tomasbaran
tomasbaran / fetch_json_api.dart
Last active May 13, 2020 10:29
[Flutter template] Fetch json api into your Flutter project.
// Call the method e.g. from initState like this: FetchListOfJsonsApi().getDecodedBody();
//
// Install the http plugin here: https://pub.dev/packages/http
import 'package:http/http.dart' as http;
import 'dart:convert';
class FetchListOfJsonsApi {
final String url;
FetchListOfJsonsApi({
@tomasbaran
tomasbaran / main.dart
Last active June 22, 2023 11:38
[Flutter template] Save JSON file locally on your phone in Flutter
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'dart:convert';
const String kFileName = 'myJsonFile.json';
const InputDecoration kInputDecoration = InputDecoration(
border: OutlineInputBorder(),
labelText: 'Label Text',
);