Copy and Paste  -   An Application to Copy/Paste Text  

 
S.No 5961 Name phpflutter Date/Time 23-Jun-2024 10:43:04 AM

Copy text from below
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart';
import 'package:http/http.dart' as http;

String serverAddress = "http://192.168.0.109/phpapp/";

class Data {
  final int userid;
  final String uname;
  final int age;

  const Data({
    required this.userid,
    required this.uname,
    required this.age,
  });

  factory Data.fromJson(Map<String, dynamic> json) {
    return switch (json) {
      {
        'userid': int userid,
        'uname': String uname,
        'age': int age,
      } =>
        Data(
          userid: userid,
          uname: uname,
          age: age,
        ),
      _ => throw const FormatException('Failed to load Data.'),
    };
  }
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _uname = "Press the button to fetch user's name in Text() widget";
  FilePickerResult? _file;
  bool _isUploading = false;

  void fetchAlbum() async {
    final response = await http
        .get(Uri.parse('https://jsonplaceholder.typicode.com/albums/1'));

    if (response.statusCode == 200) {
      // If the server did return a 200 OK response,
      // then parse the JSON.
      var data = jsonDecode(response.body);
      print(data);
    } else {
      // If the server did not return a 200 OK response,
      // then throw an exception.
      throw Exception('Failed to load album');
    }
  }

  void fetchData() async {
    final response =
        await http.get(Uri.parse("$serverAddress/getsingleobject.php"));

    if (response.statusCode == 200) {
      // If the server did return a 200 OK response,
      // then parse the JSON.
      var data =
          Data.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
      setState(() {
        _uname = data.uname;
      });
    } else {
      // If the server did not return a 200 OK response,
      // then throw an exception.
      throw Exception('Failed to load Data');
    }
  }

  void fetchAllData() async {
    final response = await http.get(Uri.parse("$serverAddress/getalldata.php"));

    if (response.statusCode == 200) {
      // If the server did return a 200 OK response,
      // then parse the JSON.
      var list = jsonDecode(response.body);

      for (var item in list) {
        debugPrint("${item['userid'




comments powered by Disqus
NEW ENTRIES
S.No Name Entry Time/Date
5989 landscape 12-Jul-2024 04:02:16 PM
5988 aaa 12-Jul-2024 09:32:46 AM
5987 Emi Pet Mobi 11-Jul-2024 10:29:07 AM
5986 snake 11-Jul-2024 08:24:29 AM
5985 player 10-Jul-2024 02:00:49 PM
5984 movement 10-Jul-2024 08:52:29 AM
5983 snake 10-Jul-2024 08:50:12 AM
5982 af 09-Jul-2024 09:24:28 AM
5981 aa 08-Jul-2024 10:55:34 PM
5980 flu1 08-Jul-2024 04:02:35 PM
5979 flu 08-Jul-2024 03:58:49 PM
5978 Emi Pet | Po 08-Jul-2024 03:40:03 PM
5977 Empire Home 07-Jul-2024 08:31:42 AM
5976 Empire Meals 05-Jul-2024 11:37:32 AM
5975 prb 05-Jul-2024 09:07:27 AM
5974 Vital Eagles 03-Jul-2024 09:09:55 AM
5973 C34 02-Jul-2024 03:07:34 PM
5972 C33 02-Jul-2024 02:32:40 PM
5971 Vital Inc. 02-Jul-2024 07:55:25 AM
5970 container 01-Jul-2024 03:06:18 PM
5969 new 01-Jul-2024 12:48:17 PM
5968 360 Modular 29-Jun-2024 03:16:17 PM
5967 quiz 28-Jun-2024 08:10:48 PM
5966 gesture 28-Jun-2024 07:56:05 PM
5965 Garden Distr 28-Jun-2024 09:34:32 AM
5964 Child Sexy 27-Jun-2024 10:29:38 AM
5963 error 24-Jun-2024 04:48:13 PM
5962 senddata 24-Jun-2024 02:17:52 PM
5961 phpflutter 23-Jun-2024 10:43:04 AM
5960 Tiki Grip & 22-Jun-2024 03:11:17 PM

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 [Next] [Last]
 
web counter
web counter


To report any error messages or bugs, or other issues, please send email at: info@pakproject.com