flutter_support_pack 0.0.5+1
flutter_support_pack: ^0.0.5+1 copied to clipboard

Flutter Android iOS

Commanly used features in on package to reduce number of imports and dependancy issues

flutter_support_pack #

pub package

Commanly used features in on package to reduce number of imports and dependancy issues

Usage #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  flutter_support_pack: ^0.0.1

In your library add the following import:

import 'package:flutter_support_pack/flutter_support_pack.dart';

Packages (more to come) #

Validators #

Validators api provide you to validate form fields as well as other text validations.

validateRequired #

Only you need to pass the value that needs be get validated.

validateEmail #

Here you can pass an string value which needs to be get validated as an email.

validateMobileNumber #

Pass a string value and other parameeters as per requirement get validated.

Properties

PropertyTypeDefault ValueDescription
valueStringnullThe phone number. By default validate for SL phone numbers. Use pattern for any custom numbers
allowLandNumberboolfalseEnable land number validation. Only avaiable for SL country format
optionalboolfalseSets the field as an optional
patternStringnullPass a custom pattern to validate

validateNIC #

Pass a string value and this method only works for SL.

validateConfirmPassword #

Validates current field value against provided value.

Properties

PropertyTypeDefault ValueDescription
valueStringnullField password value
passwordStringnullExisting password

Example Useage

TextFormField(
  controller: newPasswordController,
  focusNode: focusNewPassword,
  keyboardType: TextInputType.visiblePassword,
  obscureText: true,
  maxLines: 1,
  textInputAction: TextInputAction.next,
  validator: (value) =>
      Validators.validateConfirmPassword(
    value,
    [currentPassword],
  ),
  decoration: InputDecoration(
    labelText: 'New Password',
  ),
),

validatePinCode #

Validates a pin code.

Properties

PropertyTypeDefault ValueDescription
valueStringnullPin code value
lengthint6Define the length of the pin code

SL means Sri Lanka

Log #

Log api provide you the easy way to log your info, debug, warn and error logs. Also capable of log to flutter crashlytics.

Properties #

PropertyTypeDefault ValueDescription
logInDebugModebooltrueEnable loggin in debug mode (kDebugMode)
logInReleaseModeboolfalseEnable loggin in release mode (kReleaseMode)
enableFirebaseCrashlyticsInDebugboolfalseEnable Firebase Crashlytics logging in debug mode (kDebugMode). If enabled you may initialize Firebase before Log.init()
enableFirebaseCrashlyticsInReleaseboolfalseEnable Firebase Crashlytics logging in release mode (kReleaseMode). If enabled you may initialize Firebase before Log.init()

Initialize #

You may initialize in the main function


void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize Firebase app if only using Firebase Crashlytics
  // await Firebase.initializeApp();

  // Initialize Log
  Log.init(
        logInDebugMode: true,
        logInReleaseMode: false,
        enableFirebaseCrashlyticsInDebug: false,
        enableFirebaseCrashlyticsInRelease: false);

  runApp(MyApp());
}

Example Usage #

You can use references parameter to mention any extra debug information to easily recodnice in log


Log.i(TAG, 'initialized', references: ['initState']);
Log.d(TAG, '$_counter', references: ['_incrementCounter', 'begin']);
Log.w(TAG, 'about to hit the level => $_counter', references: ['_incrementCounter']);
Log.e(TAG, '$_counter', references: ['_incrementCounter'], exception: e);

0
likes
90
pub points
37%
popularity

Publisher

ceyloncodelabs.com

Commanly used features in on package to reduce number of imports and dependancy issues

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

firebase_core, firebase_crashlytics, flutter, intl

More

Packages that depend on flutter_support_pack