Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nikhil Singh nikhilmufc7

🏠
Working from home
View GitHub Profile
@nikhilmufc7
nikhilmufc7 / auth.dart
Last active Nov 14, 2021
Firebase Flutter Platform Exception Codes and example
View auth.dart
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
@nikhilmufc7
nikhilmufc7 / main.dart
Created Sep 21, 2021
Video Player Flutter Demo with Controls
View main.dart
import 'dart:io';
import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:video_player/video_player.dart';
void main() {
runApp(MyApp());
}
View main.dart
void main() {
isProperlyNested(String str) {
var splittedString = str.split("");
List outputs = [];
for (var i = 0; i < str.length; i++) {
var currentVal = str[i];
if (currentVal == '{' || currentVal == '(' || currentVal == '[') {
outputs.add(currentVal);
View main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
class PremiumScreen extends StatefulWidget {
@override
_PremiumScreenState createState() => _PremiumScreenState();
}
class _PremiumScreenState extends State<PremiumScreen> {
View main.dart
Future _getPurchaseHistory() async {
List<PurchasedItem> items =
await FlutterInappPurchase.instance.getPurchaseHistory();
for (var item in items) {
print('${item.toString()}');
this._purchases.add(item);
}
setState(() {
View main.dart
Future _getProduct() async {
List<IAPItem> items =
await FlutterInappPurchase.instance.getProducts(_productLists);
for (var item in items) {
print('${item.toString()}');
this._items.add(item);
}
setState(() {
this._items = items;
View main.dart
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
final user = await FirebaseAuth.instance.currentUser();
try {
platformVersion = await FlutterInappPurchase.instance.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
View in_app_purchase.dart
List<Widget> _button() {
List<Widget> widgets = this
._items
.map((item) => Container(
margin: EdgeInsets.symmetric(vertical: 10.0),
child: Container(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
View flutter_in_app_purchase.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:ielts/screens/home_screen.dart';
import 'package:ielts/utils/app_constants.dart';
View cat carousel