Skip to content

Instantly share code, notes, and snippets.

View AbhishekDoshi26's full-sized avatar
💙
Flutter

Abhishek Doshi AbhishekDoshi26

💙
Flutter
View GitHub Profile
import 'package:gps/gps.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';
import 'package:geolocator/geolocator.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite/tflite.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
));
class MyApp extends StatefulWidget {
Restarted application in 2,643ms.
D/Surface (24564): Surface::connect(this=0x6f0fd88000,api=1)
D/mali_winsys(24564): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/Choreographer(24564): Skipped 51 frames! The application may be doing too much work on its main thread.
D/Surface (24564): Surface::disconnect(this=0x6f0fa2f000,api=1)
D/Surface (24564): Surface::connect(this=0x6f0fa2f000,api=1)
D/mali_winsys(24564): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface (24564): Surface::setBufferCount(this=0x6f0fa2f000,bufferCount=3)
[log] URL:https://ydi99sjdn9.execute-api.ap-southeast-1.amazonaws.com/v1/feeds
D/NetdClient(24564): queryResolvNetidForUid nid:0, uid:10768, command.cmdId:12
@AbhishekDoshi26
AbhishekDoshi26 / example.dart
Created April 24, 2021 12:13
Lottie Animation Example
class LottieAnimationExample extends StatefulWidget{
@override
LottieAnimationExampleState createState() => LottieAnimationExampleState();
}
class LottieAnimationExampleState extends State<LottieAnimationExample> with TickerProviderStateMixin{
AnimationController _lottieAnimationController;
@override
void initState(){
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
private static final String CHANNEL = "flutter.native/helperChannel";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
-
(BOOL) application: (UIApplication * ) application
didFinishLaunchingWithOptions: (NSDictionary * ) launchOptions {
FlutterViewController * controller = (FlutterViewController * ) self.window.rootViewController;
FlutterMethodChannel * nativeChannel = [FlutterMethodChannel
@AbhishekDoshi26
AbhishekDoshi26 / main.dart
Last active July 24, 2021 14:34
Platform Channel Flutter Code
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new HomePage(),
);
@AbhishekDoshi26
AbhishekDoshi26 / home.dart
Created July 28, 2021 07:38
Added WidgetsBindingObserver
import 'package:flutter/material.dart';
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> with WidgetsBindingObserver {
import 'dart:convert';
Welcome welcomeFromJson(String str) => Welcome.fromJson(json.decode(str));
String welcomeToJson(Welcome data) => json.encode(data.toJson());
class Welcome {
Welcome({
this.name,
this.age,
this.technology,
});
String name;
import 'dart:convert';
Welcome welcomeFromJson(String str) => Welcome.fromJson(json.decode(str));
String welcomeToJson(Welcome data) => json.encode(data.toJson());
class Welcome {
Welcome({
this.name,
this.age,
this.technology,
});
String name;