flutter_use_video 1.0.0
flutter_use_video: ^1.0.0 copied to clipboard
Video playback hooks for Flutter applications. Provides useAssetVideo and useNetworkVideo hooks for comprehensive video player functionality and state management.
A collection of Flutter Hooks inspired by React's react-use
library. This monorepo contains multiple packages providing different categories of hooks for Flutter development.
📦 Packages #
Package | Description | Version |
---|---|---|
flutter_use |
Core hooks library with essential utilities | |
flutter_use_audio |
Audio playback and control hooks | |
flutter_use_battery |
Battery state monitoring hooks | |
flutter_use_geolocation |
Location and permission hooks | |
flutter_use_network_state |
Network connectivity hooks | |
flutter_use_sensors |
Device sensors hooks | |
flutter_use_video |
Video playbook hooks |
🚀 Installation #
For the core package:
flutter pub add flutter_use
For specialized packages:
flutter pub add flutter_use_audio # Audio hooks
flutter pub add flutter_use_battery # Battery hooks
# ... and so on
🌐 Interactive Demo Site #
Try out all hooks with live examples at: https://wasabeef.github.io/flutter_use/
📚 Hooks by Category #
📱 Mobile-first Hooks #
Core package: flutter_use
useAsync
— manages async operations with loading, data, and error states.useDebounceFn
— debounces function calls for better performance.useInfiniteScroll
— implements infinite scrolling with automatic loading.useForm
— comprehensive form state management with validation.useKeyboard
— tracks keyboard visibility and manages layouts (mobile only).
🎭 State Management #
Core package: flutter_use
useToggle
anduseBoolean
— tracks state of a boolean.useCounter
anduseNumber
— tracks state of a number.useList
— tracks state of an array.useMap
— tracks state of a map.useSet
— tracks state of a Set.useStateList
— circularly iterates over an array.useDefault
— returns the default value when state isnull
.useLatest
— returns the latest state or props.usePreviousDistinct
— likeusePrevious
but with a predicate to determine ifprevious
should update.useTextFormValidator
— reactive form validation with real-time feedback.
⏱️ Timing & Animation #
Core package: flutter_use
useInterval
— re-builds component on a set interval usingTimer.periodic
.useTimeout
— re-builds component after a timeout.useTimeoutFn
— calls given function after a timeout.useUpdate
— returns a callback, which re-builds component when called.
🔄 Side Effects & Performance #
Core package: flutter_use
useFutureRetry
—useFuture
with an additional retry method.useDebounce
— debounces a function.useThrottle
— throttles a value to update at most once per duration.useThrottleFn
— throttles a function to execute at most once per duration.useError
— error dispatcher.useException
— exception dispatcher.
🎯 UI Interactions #
Core package: flutter_use
useScroll
— tracks a widget's scroll position.useScrolling
— tracks whether widget is scrolling.useClickAway
— triggers callback when user clicks outside target area.useCopyToClipboard
— copies text to clipboard.
♻️ Lifecycle Management #
Core package: flutter_use
useEffectOnce
— a modifieduseEffect
hook that only runs once.useLifecycles
— callsmount
andunmount
callbacks.useMount
— callsmount
callbacks.useUnmount
— callsunmount
callbacks.useUpdateEffect
— run aneffect
only on updates.useCustomCompareEffect
— run aneffect
depending on deep comparison of its dependencies.useFirstMountState
— check if current build is first.useBuildsCount
— count component builds.
🎨 Development & Debugging #
Core package: flutter_use
useLogger
— logs in console as component goes through life-cycles.
📱 Device Sensors #
Package: flutter_use_sensors
useAccelerometer
,useUserAccelerometer
,useGyroscope
, anduseMagnetometer
— tracks accelerometer, gyroscope, and magnetometer sensors.
Core package: flutter_use
useOrientation
— tracks state of device's screen orientation.useOrientationFn
— calls given function when screen orientation changes.
🔋 Device Information #
Package: flutter_use_battery
useBattery
— tracks device battery state.
Package: flutter_use_geolocation
useGeolocation
— tracks geo location and permission state of user's device.
Package: flutter_use_network_state
useNetworkState
— tracks the state of apps network connection.
🎵 Media #
Package: flutter_use_audio
useAudio
— plays audio and exposes its controls.
Package: flutter_use_video
useAssetVideo
anduseNetworkVideo
— plays video, tracks its state, and exposes playback controls.
🚧 Coming Soon #
useEvent
— subscribe to events.useFullscreen
— display an element or video full-screen.usePageLeave
— triggers when mouse leaves page boundaries.usePermission
— query permission status for apps APIs.useMethods
— neat alternative touseReducer
.useSetState
— createssetState
method which works likethis.setState
.usePromise
— resolves promise only while component is mounted.useObservable
— tracks latest value of anObservable
.
Unlicense — public domain.